From: Alex Lorenz Date: Thu, 9 Nov 2017 20:50:59 +0000 (+0000) Subject: [index] tag declarations should use the decl role instead of ref X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d92fd0ae00786313c620da55bddb420fd2008894;p=clang [index] tag declarations should use the decl role instead of ref The 'decl' role is more canonical than the 'ref'. This helps us establish the 'specialization-of' relation just by looking at decls or defs. rdar://31884960 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317832 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index 2704e6da95..0615aeacea 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -354,12 +354,10 @@ public: gatherTemplatePseudoOverrides(D, Relations); IndexCtx.indexTagDecl(D, Relations); } else { - auto *Parent = dyn_cast(D->getDeclContext()); SmallVector Relations; gatherTemplatePseudoOverrides(D, Relations); - return IndexCtx.handleReference(D, D->getLocation(), Parent, - D->getLexicalDeclContext(), - SymbolRoleSet(), Relations); + return IndexCtx.handleDecl(D, D->getLocation(), SymbolRoleSet(), + Relations, D->getLexicalDeclContext()); } } return true; diff --git a/test/Index/Core/index-source.cpp b/test/Index/Core/index-source.cpp index 6ad600b351..6f485feb47 100644 --- a/test/Index/Core/index-source.cpp +++ b/test/Index/Core/index-source.cpp @@ -201,8 +201,8 @@ class PseudoOverridesInSpecializations { template class InnerClass; -// CHECK: [[@LINE-1]]:9 | class(Gen)/C++ | InnerClass | c:@S@PseudoOverridesInSpecializations>#d#I@ST>1#T@InnerClass | | Ref,RelCont,RelSpecialization | rel: 2 -// CHECK-NEXT: RelCont +// CHECK: [[@LINE-1]]:9 | class(Gen)/C++ | InnerClass | c:@S@PseudoOverridesInSpecializations>#d#I@ST>1#T@InnerClass | | Decl,RelChild,RelSpecialization | rel: 2 +// CHECK-NEXT: RelChild // CHECK-NEXT: RelSpecialization | InnerClass | c:@ST>2#T#T@PseudoOverridesInSpecializations@ST>1#T@InnerClass }; @@ -274,7 +274,7 @@ void ContainsSpecializedMemberFunction::memberSpecialization() { template class SpecializationDecl; -// CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | | Ref | rel: 0 +// CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | | Decl | rel: 0 template class SpecializationDecl { };