Author: arphaman Date: Thu Nov 9 12:50:59 2017 New Revision: 317832 URL: http://llvm.org/viewvc/llvm-project?rev=317832&view=rev Log: [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 Modified: cfe/trunk/lib/Index/IndexDecl.cpp cfe/trunk/test/Index/Core/index-source.cpp Modified: cfe/trunk/lib/Index/IndexDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexDecl.cpp?rev=317832&r1=317831&r2=317832&view=diff ============================================================================== --- cfe/trunk/lib/Index/IndexDecl.cpp (original) +++ cfe/trunk/lib/Index/IndexDecl.cpp Thu Nov 9 12:50:59 2017 @@ -354,12 +354,10 @@ public: gatherTemplatePseudoOverrides(D, Relations); IndexCtx.indexTagDecl(D, Relations); } else { - auto *Parent = dyn_cast<NamedDecl>(D->getDeclContext()); SmallVector<SymbolRelation, 1> 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; Modified: cfe/trunk/test/Index/Core/index-source.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.cpp?rev=317832&r1=317831&r2=317832&view=diff ============================================================================== --- cfe/trunk/test/Index/Core/index-source.cpp (original) +++ cfe/trunk/test/Index/Core/index-source.cpp Thu Nov 9 12:50:59 2017 @@ -201,8 +201,8 @@ class PseudoOverridesInSpecializations<d template<typename U> class InnerClass; -// CHECK: [[@LINE-1]]:9 | class(Gen)/C++ | InnerClass | c:@S@PseudoOverridesInSpecializations>#d#I@ST>1#T@InnerClass | <no-cgname> | 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 | <no-cgname> | 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:: template<typename T> class SpecializationDecl; -// CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | <no-cgname> | Ref | rel: 0 +// CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | <no-cgname> | Decl | rel: 0 template<typename T> class SpecializationDecl { }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits