diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-13 21:35:02 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-13 21:35:02 +0000 |
| commit | 15063e19c64149247ba277128fafbbb8a51f4eaa (patch) | |
| tree | 4869f8a4bafa9b3020dc56125949f857b9e9d8cf /clang/lib | |
| parent | 8b132433c626b3b4cd1496ccad8ee3c9b406ba65 (diff) | |
| download | bcm5719-llvm-15063e19c64149247ba277128fafbbb8a51f4eaa.tar.gz bcm5719-llvm-15063e19c64149247ba277128fafbbb8a51f4eaa.zip | |
[C++11] Replacing ObjCInterfaceDecl iterators known_categories_begin() and known_categories_end() with iterator_range known_categories(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203854
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 9 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 23 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 9 |
5 files changed, 15 insertions, 42 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 4beaaea0a42..a73c1e68a9d 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -3548,12 +3548,8 @@ bool ASTNodeImporter::ImportDefinition(ObjCInterfaceDecl *From, // Import categories. When the categories themselves are imported, they'll // hook themselves into this interface. - for (ObjCInterfaceDecl::known_categories_iterator - Cat = From->known_categories_begin(), - CatEnd = From->known_categories_end(); - Cat != CatEnd; ++Cat) { - Importer.Import(*Cat); - } + for (auto *Cat : From->known_categories()) + Importer.Import(Cat); // If we have an @implementation, import it as well. if (From->getImplementation()) { diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index fb337ba1d71..d81c53c2568 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -980,13 +980,8 @@ static void CollectOverriddenMethodsRecurse(const ObjCContainerDecl *Container, for (const auto *P : Interface->protocols()) CollectOverriddenMethodsRecurse(P, Method, Methods, MovedToSuper); - for (ObjCInterfaceDecl::known_categories_iterator - Cat = Interface->known_categories_begin(), - CatEnd = Interface->known_categories_end(); - Cat != CatEnd; ++Cat) { - CollectOverriddenMethodsRecurse(*Cat, Method, Methods, - MovedToSuper); - } + for (const auto *Cat : Interface->known_categories()) + CollectOverriddenMethodsRecurse(Cat, Method, Methods, MovedToSuper); if (const ObjCInterfaceDecl *Super = Interface->getSuperClass()) return CollectOverriddenMethodsRecurse(Super, Method, Methods, diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index a1adf1fc925..6ef5ed8d470 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -3495,14 +3495,11 @@ static void AddObjCProperties(ObjCContainerDecl *Container, } else if (ObjCInterfaceDecl *IFace = dyn_cast<ObjCInterfaceDecl>(Container)){ if (AllowCategories) { // Look through categories. - for (ObjCInterfaceDecl::known_categories_iterator - Cat = IFace->known_categories_begin(), - CatEnd = IFace->known_categories_end(); - Cat != CatEnd; ++Cat) - AddObjCProperties(*Cat, AllowCategories, AllowNullaryMethods, - CurContext, AddedProperties, Results); + for (auto *Cat : IFace->known_categories()) + AddObjCProperties(Cat, AllowCategories, AllowNullaryMethods, CurContext, + AddedProperties, Results); } - + // Look through protocols. for (auto *I : IFace->all_referenced_protocols()) AddObjCProperties(I, AllowCategories, AllowNullaryMethods, CurContext, @@ -4855,12 +4852,7 @@ static void AddObjCMethods(ObjCContainerDecl *Container, CurContext, Selectors, AllowSameLength, Results, false); // Add methods in categories. - for (ObjCInterfaceDecl::known_categories_iterator - Cat = IFace->known_categories_begin(), - CatEnd = IFace->known_categories_end(); - Cat != CatEnd; ++Cat) { - ObjCCategoryDecl *CatDecl = *Cat; - + for (auto *CatDecl : IFace->known_categories()) { AddObjCMethods(CatDecl, WantInstanceMethods, WantKind, SelIdents, CurContext, Selectors, AllowSameLength, Results, InOriginalClass); @@ -5132,10 +5124,7 @@ static ObjCMethodDecl *AddSuperSendCompletion( // Check in categories or class extensions. if (!SuperMethod) { - for (ObjCInterfaceDecl::known_categories_iterator - Cat = Class->known_categories_begin(), - CatEnd = Class->known_categories_end(); - Cat != CatEnd; ++Cat) { + for (const auto *Cat : Class->known_categories()) { if ((SuperMethod = Cat->getMethod(CurMethod->getSelector(), CurMethod->isInstanceMethod()))) break; diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index b2709c547e7..ebaae8f7b82 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -2909,12 +2909,8 @@ private: return; // - categories, - for (ObjCInterfaceDecl::known_categories_iterator - cat = iface->known_categories_begin(), - catEnd = iface->known_categories_end(); - cat != catEnd; ++cat) { - search(*cat); - } + for (auto *Cat : iface->known_categories()) + search(Cat); // - the super class, and if (ObjCInterfaceDecl *super = iface->getSuperClass()) diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 11148ebc5ef..71c51f5d7d0 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2883,15 +2883,12 @@ namespace { Tail(0) { // Populate the name -> category map with the set of known categories. - for (ObjCInterfaceDecl::known_categories_iterator - Cat = Interface->known_categories_begin(), - CatEnd = Interface->known_categories_end(); - Cat != CatEnd; ++Cat) { + for (auto *Cat : Interface->known_categories()) { if (Cat->getDeclName()) - NameCategoryMap[Cat->getDeclName()] = *Cat; + NameCategoryMap[Cat->getDeclName()] = Cat; // Keep track of the tail of the category list. - Tail = *Cat; + Tail = Cat; } } |

