diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-06-22 11:20:07 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-06-22 11:20:07 +0000 |
commit | ac0f61a33a039a52dfc4e2e7b0970c38593b0fa1 (patch) | |
tree | e5d035d9f1b9180fba68b2fb5e44fde263a9e11d /lib/Index | |
parent | 02f895ab3e0581ebf29c5b86b774911746a34570 (diff) | |
download | clang-ac0f61a33a039a52dfc4e2e7b0970c38593b0fa1.tar.gz |
[index] Add the "SpecializationOf" relation to the forward declarations
of class template specializations
This commit fixes an issue where a forward declaration of a class template
specialization was not related to the base template. We need to relate even
forward declarations because specializations don't have to be defined.
rdar://32869409
Differential Revision: https://reviews.llvm.org/D34462
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305996 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index')
-rw-r--r-- | lib/Index/IndexDecl.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index 2b0368131b..d1127722c8 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -611,18 +611,16 @@ public: ClassTemplateSpecializationDecl *D) { // FIXME: Notify subsequent callbacks if info comes from implicit // instantiation. - if (D->isThisDeclarationADefinition()) { - llvm::PointerUnion<ClassTemplateDecl *, - ClassTemplatePartialSpecializationDecl *> - Template = D->getSpecializedTemplateOrPartial(); - const Decl *SpecializationOf = - Template.is<ClassTemplateDecl *>() - ? (Decl *)Template.get<ClassTemplateDecl *>() - : Template.get<ClassTemplatePartialSpecializationDecl *>(); - IndexCtx.indexTagDecl( - D, SymbolRelation(SymbolRoleSet(SymbolRole::RelationSpecializationOf), - SpecializationOf)); - } + llvm::PointerUnion<ClassTemplateDecl *, + ClassTemplatePartialSpecializationDecl *> + Template = D->getSpecializedTemplateOrPartial(); + const Decl *SpecializationOf = + Template.is<ClassTemplateDecl *>() + ? (Decl *)Template.get<ClassTemplateDecl *>() + : Template.get<ClassTemplatePartialSpecializationDecl *>(); + IndexCtx.indexTagDecl( + D, SymbolRelation(SymbolRoleSet(SymbolRole::RelationSpecializationOf), + SpecializationOf)); if (TypeSourceInfo *TSI = D->getTypeAsWritten()) IndexCtx.indexTypeSourceInfo(TSI, /*Parent=*/nullptr, D->getLexicalDeclContext()); |