]> granicus.if.org Git - clang/commitdiff
Remove Sema::LookupObjCImplementation and replace it with just calling ObjCInterfaceD...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 21 Jul 2009 00:06:04 +0000 (00:06 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 21 Jul 2009 00:06:04 +0000 (00:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76509 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.h
lib/Sema/SemaDeclObjC.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprObjC.cpp
lib/Sema/SemaLookup.cpp
test/SemaObjC/class-impl-1.m

index 837b2c8fecb97f633c5deb0f89a39459d9f83605..1e75bb2e3de95c85f5549e5b5b5a21d4d39775d2 100644 (file)
@@ -1153,7 +1153,6 @@ public:
                                 SourceLocation Loc = SourceLocation());
 
   ObjCProtocolDecl *LookupProtocol(IdentifierInfo *II);
-  ObjCImplementationDecl *LookupObjCImplementation(IdentifierInfo *II);
   ObjCCategoryImplDecl *LookupObjCCategoryImpl(IdentifierInfo *II);
 
   void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
index 440b0fba6a7f8925a45ac607406d1632af10fcb9..89bde815c0cc4f5b4a668f6475c208fea503e197 100644 (file)
@@ -716,10 +716,12 @@ Sema::DeclPtrTy Sema::ActOnStartClassImplementation(
     return DeclPtrTy::make(IMPDecl);
   
   // Check that there is no duplicate implementation of this class.
-  if (LookupObjCImplementation(ClassName))
+  if (IDecl->getImplementation()) {
     // FIXME: Don't leak everything!
     Diag(ClassLoc, diag::err_dup_implementation_class) << ClassName;
-  else { // add it to the list.
+    Diag(IDecl->getImplementation()->getLocation(),
+         diag::note_previous_definition);
+  } else { // add it to the list.
     IDecl->setImplementation(IMPDecl);
     PushOnScopeChains(IMPDecl, TUScope);
   }
@@ -869,8 +871,7 @@ bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl,
     }
   }
   // Lastly, look through the implementation (if one is in scope).
-  if (ObjCImplementationDecl *ImpDecl 
-      = LookupObjCImplementation(IDecl->getIdentifier()))
+  if (ObjCImplementationDecl *ImpDecl = IDecl->getImplementation())
     if (ImpDecl->getInstanceMethod(PDecl->getSetterName()))
       return false;
   // If all fails, look at the super class.
index 7aa66f9b627777289f33c4bfbda84458e84cebdd..2f47c79777aaeebeeed384730dfcc7338269c9de 100644 (file)
@@ -2067,8 +2067,7 @@ ObjCMethodDecl *Sema::FindMethodInNestedImplementations(
                                               const ObjCInterfaceDecl *IFace,
                                               const Selector &Sel) {
   ObjCMethodDecl *Method = 0;
-  if (ObjCImplementationDecl *ImpDecl 
-        = LookupObjCImplementation(IFace->getIdentifier()))
+  if (ObjCImplementationDecl *ImpDecl = IFace->getImplementation())
     Method = ImpDecl->getInstanceMethod(Sel);
   
   if (!Method && IFace->getSuperClass())
index 66e1beb9838096d5f7054814db4338307315d7c9..141cd80bff679e7f11055ea8edd2f28a82f45498 100644 (file)
@@ -241,8 +241,7 @@ ObjCMethodDecl *Sema::LookupPrivateClassMethod(Selector Sel,
   ObjCMethodDecl *Method = 0;
   // lookup in class and all superclasses
   while (ClassDecl && !Method) {
-    if (ObjCImplementationDecl *ImpDecl 
-          = LookupObjCImplementation(ClassDecl->getIdentifier()))
+    if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
       Method = ImpDecl->getClassMethod(Sel);
     
     // Look through local category implementations associated with the class.
@@ -274,8 +273,7 @@ ObjCMethodDecl *Sema::LookupPrivateInstanceMethod(Selector Sel,
   ObjCMethodDecl *Method = 0;
   while (ClassDecl && !Method) {
     // If we have implementations in scope, check "private" methods.
-    if (ObjCImplementationDecl *ImpDecl
-          = LookupObjCImplementation(ClassDecl->getIdentifier()))
+    if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
       Method = ImpDecl->getInstanceMethod(Sel);
     
     // Look through local category implementations associated with the class.
@@ -307,8 +305,7 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr(
   if (!Getter)
     if (ObjCMethodDecl *CurMeth = getCurMethodDecl())
       if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface())
-        if (ObjCImplementationDecl *ImpDecl
-              = LookupObjCImplementation(ClassDecl->getIdentifier()))
+        if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
           Getter = ImpDecl->getClassMethod(Sel);
 
   if (Getter) {
@@ -329,8 +326,7 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr(
     // methods.
     if (ObjCMethodDecl *CurMeth = getCurMethodDecl())
       if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface())
-        if (ObjCImplementationDecl *ImpDecl 
-              = LookupObjCImplementation(ClassDecl->getIdentifier()))
+        if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
           Setter = ImpDecl->getClassMethod(SetterSel);
   }
   // Look through local category implementations associated with the class.
index d9dea66f825714866ef14837ab2dd4ff58e3109d..57656ce8afe418286ee847d5cc2c725d839fd3a2 100644 (file)
@@ -1671,13 +1671,6 @@ ObjCProtocolDecl *Sema::LookupProtocol(IdentifierInfo *II) {
   return cast_or_null<ObjCProtocolDecl>(D);
 }
 
-/// \brief Find the Objective-C implementation with the given name, if
-/// any.
-ObjCImplementationDecl *Sema::LookupObjCImplementation(IdentifierInfo *II) {
-  Decl *D = LookupName(TUScope, II, LookupObjCImplementationName).getAsDecl();
-  return cast_or_null<ObjCImplementationDecl>(D);
-}
-
 /// \brief Find the Objective-C category implementation with the given
 /// name, if any.
 ObjCCategoryImplDecl *Sema::LookupObjCCategoryImpl(IdentifierInfo *II) {
index 5a67bef3d605bbfc02260566f8ceec52f08f35a3..09ad1556c035dd5ef1ab2e3f5c206cb2ef373161 100644 (file)
@@ -9,7 +9,7 @@ typedef int INTF3; // expected-note {{previous definition is here}}
 @interface INTF  : OBJECT
 @end
 
-@implementation INTF @end 
+@implementation INTF @end // expected-note {{previous definition is here}}
 
 @implementation INTF //  expected-error {{reimplementation of class 'INTF'}}
 @end