[cfe-commits] r135314 - in /cfe/trunk: include/clang/AST/DeclObjC.h tools/libclang/CIndex.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Jul 15 15:27:18 PDT 2011


Author: akirtzidis
Date: Fri Jul 15 17:27:18 2011
New Revision: 135314

URL: http://llvm.org/viewvc/llvm-project?rev=135314&view=rev
Log:
Revert r135304 and apply fix in clang_getCanonicalCursor per Doug's, Fariborz's comments.

Modified:
    cfe/trunk/include/clang/AST/DeclObjC.h
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=135314&r1=135313&r2=135314&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Fri Jul 15 17:27:18 2011
@@ -1122,12 +1122,6 @@
       ClassInterface(classInterface) {}
 
 public:
-  virtual Decl *getCanonicalDecl() {
-    if (Decl *interface = getClassInterface())
-      return interface;
-    return this;
-  }
-
   const ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
   ObjCInterfaceDecl *getClassInterface() { return ClassInterface; }
   void setClassInterface(ObjCInterfaceDecl *IFace);

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=135314&r1=135313&r2=135314&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Jul 15 17:27:18 2011
@@ -4141,8 +4141,13 @@
   if (!clang_isDeclaration(C.kind))
     return C;
   
-  if (Decl *D = getCursorDecl(C))
+  if (Decl *D = getCursorDecl(C)) {
+    if (ObjCImplDecl *ImplD = dyn_cast<ObjCImplDecl>(D))
+      if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface())
+        return MakeCXCursor(IFD, getCursorTU(C));
+
     return MakeCXCursor(D->getCanonicalDecl(), getCursorTU(C));
+  }
   
   return C;
 }





More information about the cfe-commits mailing list