[cfe-commits] r83224 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp lib/Sema/Sema.h lib/Sema/SemaExpr.cpp

Steve Naroff snaroff at apple.com
Thu Oct 1 16:46:05 PDT 2009


Author: snaroff
Date: Thu Oct  1 18:46:04 2009
New Revision: 83224

URL: http://llvm.org/viewvc/llvm-project?rev=83224&view=rev
Log:
- Remove Sema::FindMethodInNestedImplementations().
- Add ObjCInterfaceDecl::lookupPrivateInstanceMethod().
- Convert clients.

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


Modified:
    cfe/trunk/include/clang/AST/DeclObjC.h
    cfe/trunk/lib/AST/DeclObjC.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=83224&r1=83223&r2=83224&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Oct  1 18:46:04 2009
@@ -513,6 +513,9 @@
     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 @@
   ObjCMethodDecl *lookupClassMethod(Selector Sel) const {
     return lookupMethod(Sel, false/*isInstance*/);
   }
-
+  
   bool isForwardDecl() const { return isForwardProtoDecl; }
   void setForwardDecl(bool val) { isForwardProtoDecl = val; }
 

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=83224&r1=83223&r2=83224&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Thu Oct  1 18:46:04 2009
@@ -184,7 +184,16 @@
   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

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=83224&r1=83223&r2=83224&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Thu Oct  1 18:46:04 2009
@@ -1270,10 +1270,6 @@
   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.

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=83224&r1=83223&r2=83224&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Oct  1 18:46:04 2009
@@ -2001,21 +2001,6 @@
   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 @@
       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 @@
 
     // 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 @@
     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)





More information about the cfe-commits mailing list