]> granicus.if.org Git - clang/commitdiff
- Remove Sema::FindMethodInNestedImplementations().
authorSteve Naroff <snaroff@apple.com>
Thu, 1 Oct 2009 23:46:04 +0000 (23:46 +0000)
committerSteve Naroff <snaroff@apple.com>
Thu, 1 Oct 2009 23:46:04 +0000 (23:46 +0000)
- Add ObjCInterfaceDecl::lookupPrivateInstanceMethod().
- Convert clients.

No functionality change - One less method in Sema:-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83224 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclObjC.h
lib/AST/DeclObjC.cpp
lib/Sema/Sema.h
lib/Sema/SemaExpr.cpp

index 6263246acf559c33611829431d1ad2811cc3ce31..fec2607fac78ef6fa65466a3b65b7802a3b06ba5 100644 (file)
@@ -513,6 +513,9 @@ public:
     return lookupMethod(Sel, false/*isInstance*/);
   }
   ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName);
+  
+  // Lookup a method in the classes implementation hierarchy.
+  ObjCMethodDecl *lookupPrivateInstanceMethod(const Selector &Sel);
 
   // Location information, modeled after the Stmt API.
   SourceLocation getLocStart() const { return getLocation(); } // '@'interface
@@ -690,7 +693,7 @@ public:
   ObjCMethodDecl *lookupClassMethod(Selector Sel) const {
     return lookupMethod(Sel, false/*isInstance*/);
   }
-
+  
   bool isForwardDecl() const { return isForwardProtoDecl; }
   void setForwardDecl(bool val) { isForwardProtoDecl = val; }
 
index d6e4b2c44bba7529ae45eaf779aa05206bae49ee..4185ac1682891cae70dd3ad81a21d0d69969a4d7 100644 (file)
@@ -184,7 +184,16 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel,
   return NULL;
 }
 
-
+ObjCMethodDecl *ObjCInterfaceDecl::lookupPrivateInstanceMethod(
+                                   const Selector &Sel) {
+  ObjCMethodDecl *Method = 0;
+  if (ObjCImplementationDecl *ImpDecl = getImplementation())
+    Method = ImpDecl->getInstanceMethod(Sel);
+  
+  if (!Method && getSuperClass())
+    return getSuperClass()->lookupPrivateInstanceMethod(Sel);
+  return Method;
+}
 
 //===----------------------------------------------------------------------===//
 // ObjCMethodDecl
index b234d56fa013c4dd16aae022158a748f219260e7..7354d7cf94ea0d69793608a7c9956d45f92a3c39 100644 (file)
@@ -1270,10 +1270,6 @@ private:
   std::pair<bool, LookupResult> CppLookupName(Scope *S, DeclarationName Name,
                                               LookupNameKind NameKind,
                                               bool RedeclarationOnly);
-  ObjCMethodDecl *FindMethodInNestedImplementations(
-                                                const ObjCInterfaceDecl *IFace,
-                                                const Selector &Sel);
-
 public:
   /// Determines whether D is a suitable lookup result according to the
   /// lookup criteria.
index 414525d6c3322fdf8317d6f9354d2415a58e2495..7b7ee820c5182f0e5dec57536f7b16d9db77901a 100644 (file)
@@ -2001,21 +2001,6 @@ static Decl *FindGetterNameDecl(const ObjCObjectPointerType *QIdTy,
   return GDecl;
 }
 
-/// FindMethodInNestedImplementations - Look up a method in current and
-/// all base class implementations.
-///
-ObjCMethodDecl *Sema::FindMethodInNestedImplementations(
-                                              const ObjCInterfaceDecl *IFace,
-                                              const Selector &Sel) {
-  ObjCMethodDecl *Method = 0;
-  if (ObjCImplementationDecl *ImpDecl = IFace->getImplementation())
-    Method = ImpDecl->getInstanceMethod(Sel);
-
-  if (!Method && IFace->getSuperClass())
-    return FindMethodInNestedImplementations(IFace->getSuperClass(), Sel);
-  return Method;
-}
-
 Action::OwningExprResult
 Sema::BuildMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
                                tok::TokenKind OpKind, SourceLocation MemberLoc,
@@ -2075,7 +2060,7 @@ Sema::BuildMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
       if (!Setter) {
         // If this reference is in an @implementation, also check for 'private'
         // methods.
-        Setter = FindMethodInNestedImplementations(IFace, SetterSel);
+        Setter = IFace->lookupPrivateInstanceMethod(SetterSel);
       }
       // Look through local category implementations associated with the class.
       if (!Setter)
@@ -2526,7 +2511,7 @@ Sema::BuildMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
 
     // If this reference is in an @implementation, check for 'private' methods.
     if (!Getter)
-      Getter = FindMethodInNestedImplementations(IFace, Sel);
+      Getter = IFace->lookupPrivateInstanceMethod(Sel);
 
     // Look through local category implementations associated with the class.
     if (!Getter)
@@ -2545,7 +2530,7 @@ Sema::BuildMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
     if (!Setter) {
       // If this reference is in an @implementation, also check for 'private'
       // methods.
-      Setter = FindMethodInNestedImplementations(IFace, SetterSel);
+      Setter = IFace->lookupPrivateInstanceMethod(SetterSel);
     }
     // Look through local category implementations associated with the class.
     if (!Setter)