[cfe-commits] r135314 - in /cfe/trunk: include/clang/AST/DeclObjC.h tools/libclang/CIndex.cpp
Douglas Gregor
dgregor at apple.com
Fri Jul 15 15:29:59 PDT 2011
On Jul 15, 2011, at 3:27 PM, Argyrios Kyrtzidis wrote:
> 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.
Thanks! One last comment, though…
> 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));
> + }
I think the canonical cursor of a category implementation should be the category, rather than the interface.
- Doug
More information about the cfe-commits
mailing list