From 4cb22979c55b62c848b971de9d3f8dbdbc123eee Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 11 Jan 2017 21:08:31 +0000 Subject: [PATCH] [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 --- lib/Index/IndexDecl.cpp | 11 ++++++----- 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 | | | | Decl | rel: 0 +// CHECK-NOT: [[@LINE+1]]:12 | extension/ObjC | @interface NonExistent() @end -- 2.40.0