Provide a new kind of iterator, the specific_decl_iterator, that
filters the decls seen by decl_iterator with two criteria: the dynamic
type of the declaration and a run-time predicate described by a member
function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl
considerably. It has no measurable performance impact.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61994 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 2599561..f39b84c 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -30,7 +30,7 @@
     return;
 
   // Allow the rest of sema to find private method decl implementations.
-  if (MDecl->isInstance())
+  if (MDecl->isInstanceMethod())
     AddInstanceMethodToGlobalPool(MDecl);
   else
     AddFactoryMethodToGlobalPool(MDecl);
@@ -1172,7 +1172,7 @@
       cast_or_null<ObjCMethodDecl>(static_cast<Decl*>(allMethods[i]));
 
     if (!Method) continue;  // Already issued a diagnostic.
-    if (Method->isInstance()) {
+    if (Method->isInstanceMethod()) {
       /// Check for instance method of the same name with incompatible types
       const ObjCMethodDecl *&PrevMethod = InsMap[Method->getSelector()];
       bool match = PrevMethod ? MatchTwoMethodDeclarations(Method, PrevMethod) 
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index de99e18..415bc94 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -197,7 +197,7 @@
       ClassDecl = OID->getSuperClass();
       if (!ClassDecl)
         return Diag(lbrac, diag::error_no_super_class) << OID->getDeclName();
-      if (getCurMethodDecl()->isInstance()) {
+      if (getCurMethodDecl()->isInstanceMethod()) {
         QualType superTy = Context.getObjCInterfaceType(ClassDecl);
         superTy = Context.getPointerType(superTy);
         ExprResult ReceiverExpr = new ObjCSuperExpr(SourceLocation(), superTy);
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index f780342..8a459f4 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -568,7 +568,7 @@
   llvm::SmallVector<QualType, 16> ArgTys;
   
   // Add the first two invisible argument types for self and _cmd.
-  if (MDecl->isInstance()) {
+  if (MDecl->isInstanceMethod()) {
     QualType selfTy = Context.getObjCInterfaceType(MDecl->getClassInterface());
     selfTy = Context.getPointerType(selfTy);
     ArgTys.push_back(selfTy);