diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-01-11 21:08:31 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-01-11 21:08:31 +0000 |
commit | 4cb22979c55b62c848b971de9d3f8dbdbc123eee (patch) | |
tree | ce2467a0c422ab8011b90c9b9af8be80825a13ba | |
parent | 8293248be4a9ec4f21cddf7b86baa4728890c558 (diff) |
[index] Ignore invalid ObjC categories.
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
-rw-r--r-- | lib/Index/IndexDecl.cpp | 11 | ||||
-rw-r--r-- | test/Index/Core/index-source.m | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index 6c5b2e520e..7d60aad389 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -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(); diff --git a/test/Index/Core/index-source.m b/test/Index/Core/index-source.m index f1275b2fd6..375a20d849 100644 --- a/test/Index/Core/index-source.m +++ b/test/Index/Core/index-source.m @@ -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 |