diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-06 23:45:36 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-06 23:45:36 +0000 |
commit | 86c9390673f4be9a4064b7f3aa3a25636465758c (patch) | |
tree | 41f242a1d9e359fc2c87cf3a462faa7170dabab7 /clang/lib/Serialization/ASTReader.cpp | |
parent | 0e4b605e475690f8899c8a8a45e25b24138d2b82 (diff) | |
download | bcm5719-llvm-86c9390673f4be9a4064b7f3aa3a25636465758c.tar.gz bcm5719-llvm-86c9390673f4be9a4064b7f3aa3a25636465758c.zip |
[C++11] Replacing iterators redecls_begin() and redecls_end() with iterator_range redecls(). Updating all of the usages of the iterators with range-based for loops, which allows the begin/end forms to be removed entirely.
llvm-svn: 203179
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index cc218a2807b..0afe262396d 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -7676,16 +7676,14 @@ void ASTReader::finishPendingActions() { llvm::SmallVector<const NamedDecl*, 4> Candidates; for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); !Found && I != E; ++I) { - for (Decl::redecl_iterator RI = (*I)->redecls_begin(), - RE = (*I)->redecls_end(); - RI != RE; ++RI) { - if ((*RI)->getLexicalDeclContext() == CanonDef) { + for (auto RI : (*I)->redecls()) { + if (RI->getLexicalDeclContext() == CanonDef) { // This declaration is present in the canonical definition. If it's // in the same redecl chain, it's the one we're looking for. - if ((*RI)->getCanonicalDecl() == DCanon) + if (RI->getCanonicalDecl() == DCanon) Found = true; else - Candidates.push_back(cast<NamedDecl>(*RI)); + Candidates.push_back(cast<NamedDecl>(RI)); break; } } @@ -7726,44 +7724,35 @@ void ASTReader::finishPendingActions() { const_cast<TagType*>(TagT)->decl = TD; } - if (CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(*D)) { - for (CXXRecordDecl::redecl_iterator R = RD->redecls_begin(), - REnd = RD->redecls_end(); - R != REnd; ++R) - cast<CXXRecordDecl>(*R)->DefinitionData = RD->DefinitionData; + if (auto RD = dyn_cast<CXXRecordDecl>(*D)) { + for (auto R : RD->redecls()) + cast<CXXRecordDecl>(R)->DefinitionData = RD->DefinitionData; } continue; } - if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(*D)) { + if (auto ID = dyn_cast<ObjCInterfaceDecl>(*D)) { // Make sure that the ObjCInterfaceType points at the definition. const_cast<ObjCInterfaceType *>(cast<ObjCInterfaceType>(ID->TypeForDecl)) ->Decl = ID; - for (ObjCInterfaceDecl::redecl_iterator R = ID->redecls_begin(), - REnd = ID->redecls_end(); - R != REnd; ++R) + for (auto R : ID->redecls()) R->Data = ID->Data; continue; } - if (ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(*D)) { - for (ObjCProtocolDecl::redecl_iterator R = PD->redecls_begin(), - REnd = PD->redecls_end(); - R != REnd; ++R) + if (auto PD = dyn_cast<ObjCProtocolDecl>(*D)) { + for (auto R : PD->redecls()) R->Data = PD->Data; continue; } - RedeclarableTemplateDecl *RTD - = cast<RedeclarableTemplateDecl>(*D)->getCanonicalDecl(); - for (RedeclarableTemplateDecl::redecl_iterator R = RTD->redecls_begin(), - REnd = RTD->redecls_end(); - R != REnd; ++R) + auto RTD = cast<RedeclarableTemplateDecl>(*D)->getCanonicalDecl(); + for (auto R : RTD->redecls()) R->Common = RTD->Common; } PendingDefinitions.clear(); |