/// \brief Iterator that walks over all of the known categories and
/// extensions, including those that are hidden.
typedef filtered_category_iterator<isKnownCategory> known_categories_iterator;
+ typedef llvm::iterator_range<known_categories_iterator>
+ known_categories_range;
+
+ known_categories_range known_categories() const {
+ return known_categories_range(known_categories_begin(),
+ known_categories_end());
+ }
/// \brief Retrieve an iterator to the beginning of the known-categories
/// list.
// 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()) {
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,
} 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,
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);
// 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;
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())
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;
}
}