forked from OSchip/llvm-project
[clang] NFC: Fix range-based for loop warnings related to decl lookup
This commit is contained in:
parent
2aff4f7f57
commit
6a72ed239c
|
@ -2887,7 +2887,7 @@ static void configureBlocksRuntimeObject(CodeGenModule &CGM,
|
|||
"expected Function or GlobalVariable");
|
||||
|
||||
const NamedDecl *ND = nullptr;
|
||||
for (const auto &Result : DC->lookup(&II))
|
||||
for (const auto *Result : DC->lookup(&II))
|
||||
if ((ND = dyn_cast<FunctionDecl>(Result)) ||
|
||||
(ND = dyn_cast<VarDecl>(Result)))
|
||||
break;
|
||||
|
|
|
@ -337,7 +337,7 @@ void CGNVCUDARuntime::emitDeviceStubBodyNew(CodeGenFunction &CGF,
|
|||
IdentifierInfo &cudaLaunchKernelII =
|
||||
CGM.getContext().Idents.get(LaunchKernelName);
|
||||
FunctionDecl *cudaLaunchKernelFD = nullptr;
|
||||
for (const auto &Result : DC->lookup(&cudaLaunchKernelII)) {
|
||||
for (auto *Result : DC->lookup(&cudaLaunchKernelII)) {
|
||||
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(Result))
|
||||
cudaLaunchKernelFD = FD;
|
||||
}
|
||||
|
|
|
@ -1232,7 +1232,7 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
|
|||
DeclContext *DC = TranslationUnitDecl::castToDeclContext(TUDecl);
|
||||
|
||||
const ObjCInterfaceDecl *OID = nullptr;
|
||||
for (const auto &Result : DC->lookup(&II))
|
||||
for (const auto *Result : DC->lookup(&II))
|
||||
if ((OID = dyn_cast<ObjCInterfaceDecl>(Result)))
|
||||
break;
|
||||
|
||||
|
@ -2319,7 +2319,7 @@ llvm::Value *CGObjCGNU::EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) {
|
|||
DeclContext *DC = TranslationUnitDecl::castToDeclContext(TUDecl);
|
||||
|
||||
const VarDecl *VD = nullptr;
|
||||
for (const auto &Result : DC->lookup(&II))
|
||||
for (const auto *Result : DC->lookup(&II))
|
||||
if ((VD = dyn_cast<VarDecl>(Result)))
|
||||
break;
|
||||
|
||||
|
|
|
@ -6522,7 +6522,7 @@ static llvm::GlobalValue::DLLStorageClassTypes getStorage(CodeGenModule &CGM,
|
|||
DeclContext *DC = TranslationUnitDecl::castToDeclContext(TUDecl);
|
||||
|
||||
const VarDecl *VD = nullptr;
|
||||
for (const auto &Result : DC->lookup(&II))
|
||||
for (const auto *Result : DC->lookup(&II))
|
||||
if ((VD = dyn_cast<VarDecl>(Result)))
|
||||
break;
|
||||
|
||||
|
|
|
@ -3644,8 +3644,8 @@ GetRuntimeFunctionDecl(ASTContext &C, StringRef Name) {
|
|||
DeclContext *DC = TranslationUnitDecl::castToDeclContext(TUDecl);
|
||||
|
||||
IdentifierInfo &CII = C.Idents.get(Name);
|
||||
for (const auto &Result : DC->lookup(&CII))
|
||||
if (const auto FD = dyn_cast<FunctionDecl>(Result))
|
||||
for (const auto *Result : DC->lookup(&CII))
|
||||
if (const auto *FD = dyn_cast<FunctionDecl>(Result))
|
||||
return FD;
|
||||
|
||||
if (!C.getLangOpts().CPlusPlus)
|
||||
|
@ -3659,15 +3659,15 @@ GetRuntimeFunctionDecl(ASTContext &C, StringRef Name) {
|
|||
|
||||
for (const auto &N : {"__cxxabiv1", "std"}) {
|
||||
IdentifierInfo &NS = C.Idents.get(N);
|
||||
for (const auto &Result : DC->lookup(&NS)) {
|
||||
NamespaceDecl *ND = dyn_cast<NamespaceDecl>(Result);
|
||||
if (auto LSD = dyn_cast<LinkageSpecDecl>(Result))
|
||||
for (const auto &Result : LSD->lookup(&NS))
|
||||
for (const auto *Result : DC->lookup(&NS)) {
|
||||
const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(Result);
|
||||
if (auto *LSD = dyn_cast<LinkageSpecDecl>(Result))
|
||||
for (const auto *Result : LSD->lookup(&NS))
|
||||
if ((ND = dyn_cast<NamespaceDecl>(Result)))
|
||||
break;
|
||||
|
||||
if (ND)
|
||||
for (const auto &Result : ND->lookup(&CXXII))
|
||||
for (const auto *Result : ND->lookup(&CXXII))
|
||||
if (const auto *FD = dyn_cast<FunctionDecl>(Result))
|
||||
return FD;
|
||||
}
|
||||
|
@ -5038,7 +5038,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
|
|||
DeclContext *DC = TranslationUnitDecl::castToDeclContext(TUDecl);
|
||||
|
||||
const VarDecl *VD = nullptr;
|
||||
for (const auto &Result : DC->lookup(&II))
|
||||
for (const auto *Result : DC->lookup(&II))
|
||||
if ((VD = dyn_cast<VarDecl>(Result)))
|
||||
break;
|
||||
|
||||
|
|
|
@ -5257,7 +5257,7 @@ QualType getApproximateType(const Expr *E) {
|
|||
Base = Base->getPointeeType(); // could handle unique_ptr etc here?
|
||||
RecordDecl *RD = Base.isNull() ? nullptr : getAsRecordDecl(Base);
|
||||
if (RD && RD->isCompleteDefinition()) {
|
||||
for (const auto &Member : RD->lookup(CDSME->getMember()))
|
||||
for (const auto *Member : RD->lookup(CDSME->getMember()))
|
||||
if (const ValueDecl *VD = llvm::dyn_cast<ValueDecl>(Member))
|
||||
return VD->getType().getNonReferenceType();
|
||||
}
|
||||
|
@ -5891,7 +5891,7 @@ static QualType getDesignatedType(QualType BaseType, const Designation &Desig) {
|
|||
assert(D.isFieldDesignator());
|
||||
auto *RD = getAsRecordDecl(BaseType);
|
||||
if (RD && RD->isCompleteDefinition()) {
|
||||
for (const auto &Member : RD->lookup(D.getField()))
|
||||
for (const auto *Member : RD->lookup(D.getField()))
|
||||
if (const FieldDecl *FD = llvm::dyn_cast<FieldDecl>(Member)) {
|
||||
NextType = FD->getType();
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue