]> granicus.if.org Git - clang/commitdiff
[index] Ignore invalid ObjC categories.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 11 Jan 2017 21:08:31 +0000 (21:08 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 11 Jan 2017 21:08:31 +0000 (21:08 +0000)
We currently are unable to get a USR for those and it doesn't seem useful to try to index them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291705 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Index/IndexDecl.cpp
test/Index/Core/index-source.m

index 6c5b2e520ef4731dfacf028965c23cf916fb25a7..7d60aad3895d1b03500a7a81ed8bc45c83f16618 100644 (file)
@@ -289,11 +289,12 @@ public:
 
   bool VisitObjCCategoryDecl(const ObjCCategoryDecl *D) {
     const ObjCInterfaceDecl *C = D->getClassInterface();
-    if (C)
-      TRY_TO(IndexCtx.handleReference(C, D->getLocation(), D, D,
-                                  SymbolRoleSet(), SymbolRelation{
-                                    (unsigned)SymbolRole::RelationExtendedBy, D
-                                  }));
+    if (!C)
+      return true;
+    TRY_TO(IndexCtx.handleReference(C, D->getLocation(), D, D, SymbolRoleSet(),
+                                   SymbolRelation{
+                                     (unsigned)SymbolRole::RelationExtendedBy, D
+                                   }));
     SourceLocation CategoryLoc = D->getCategoryNameLoc();
     if (!CategoryLoc.isValid())
       CategoryLoc = D->getLocation();
index f1275b2fd6da006d36a097681d1aeb7617ab0c23..375a20d849ccb21cefbc48c55579d732c9857d87 100644 (file)
@@ -159,7 +159,7 @@ extern int setjmp(jmp_buf);
 @implementation I3(bar)
 @end
 
-// CHECK: [[@LINE+1]]:12 | extension/ObjC | <no-name> | <no-usr> | <no-cgname> | Decl | rel: 0
+// CHECK-NOT: [[@LINE+1]]:12 | extension/ObjC |
 @interface NonExistent()
 @end