]> granicus.if.org Git - clang/commitdiff
Revert r135304 and apply fix in clang_getCanonicalCursor per Doug's, Fariborz's comments.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 15 Jul 2011 22:27:18 +0000 (22:27 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 15 Jul 2011 22:27:18 +0000 (22:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135314 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclObjC.h
tools/libclang/CIndex.cpp

index 88877cfe0b5948c6b6a6313d2cd7c8f68699bf1a..d318fc27a8ba1b66ed017031dcbff6d48916baae 100644 (file)
@@ -1122,12 +1122,6 @@ protected:
       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);
index 756d570d9114a5af9e3c779b136172bf5c4731e3..6f001d53814d5bd978b15638ef4fa4fde58391ec 100644 (file)
@@ -4141,8 +4141,13 @@ CXCursor clang_getCanonicalCursor(CXCursor C) {
   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;
 }