]> granicus.if.org Git - clang/commitdiff
[libclang] Map canonical decl of a category implementation to the category decl.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 15 Jul 2011 22:37:58 +0000 (22:37 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 15 Jul 2011 22:37:58 +0000 (22:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135316 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index 6f001d53814d5bd978b15638ef4fa4fde58391ec..50d56fccb9c599d2a27ade6e42387861262bd7f2 100644 (file)
@@ -4142,6 +4142,10 @@ CXCursor clang_getCanonicalCursor(CXCursor C) {
     return C;
   
   if (Decl *D = getCursorDecl(C)) {
+    if (ObjCCategoryImplDecl *CatImplD = dyn_cast<ObjCCategoryImplDecl>(D))
+      if (ObjCCategoryDecl *CatD = CatImplD->getCategoryDecl())
+        return MakeCXCursor(CatD, getCursorTU(C));
+
     if (ObjCImplDecl *ImplD = dyn_cast<ObjCImplDecl>(D))
       if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface())
         return MakeCXCursor(IFD, getCursorTU(C));