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

Argiris Kirtzidis akyrtzi at gmail.com
Mon Jul 27 22:11:06 PDT 2009


Author: akirtzidis
Date: Tue Jul 28 00:11:05 2009
New Revision: 77297

URL: http://llvm.org/viewvc/llvm-project?rev=77297&view=rev
Log:
-Add ObjCCategoryImplDecl::getCategoryClass() which returns the category interface decl.
-Correct ObjCMethodDecl::getNextRedeclaration(); A method in a ObjCCategoryImplDecl should point to
a method in the associated ObjCCategoryDecl, not the ObjCInterfaceDecl.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Jul 28 00:11:05 2009
@@ -918,6 +918,8 @@
     return Id; 
   }
   void setIdentifier(IdentifierInfo *II) { Id = II; }
+  
+  ObjCCategoryDecl *getCategoryClass() const;
 
   /// getNameAsCString - Get the name of identifier for the class
   /// interface associated with this implementation as a C string

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

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Jul 28 00:11:05 2009
@@ -233,9 +233,15 @@
     if (ObjCCategoryImplDecl *ImplD = Ctx.getObjCImplementation(CD))
       Redecl = ImplD->getMethod(getSelector(), isInstanceMethod());
 
-  } else if (ObjCImplDecl *ImplD = dyn_cast<ObjCImplDecl>(CtxD)) {
+  } else if (ObjCImplementationDecl *ImplD =
+               dyn_cast<ObjCImplementationDecl>(CtxD)) {
     if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface())
       Redecl = IFD->getMethod(getSelector(), isInstanceMethod());
+
+  } else if (ObjCCategoryImplDecl *CImplD =
+               dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
+    if (ObjCCategoryDecl *CatD = CImplD->getCategoryClass())
+      Redecl = CatD->getMethod(getSelector(), isInstanceMethod());
   }
 
   return Redecl ? Redecl : this;
@@ -532,6 +538,10 @@
   return new (C) ObjCCategoryImplDecl(DC, L, Id, ClassInterface);
 }
 
+ObjCCategoryDecl *ObjCCategoryImplDecl::getCategoryClass() const {
+  return getClassInterface()->FindCategoryDeclaration(getIdentifier());
+}
+
 
 void ObjCImplDecl::addPropertyImplementation(ObjCPropertyImplDecl *property) {
   // FIXME: The context should be correct before we get here.





More information about the cfe-commits mailing list