Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-ci committed Jun 23, 2017
2 parents 9ea73cc + a4f470e commit c926c70
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
22 changes: 10 additions & 12 deletions lib/Index/IndexDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,18 +609,16 @@ class IndexingDeclVisitor : public ConstDeclVisitor<IndexingDeclVisitor, bool> {
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());
Expand Down
10 changes: 7 additions & 3 deletions test/Index/Core/index-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ class SpecializationDecl { };

template<>
class SpecializationDecl<int>;
// CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | <no-cgname> | Ref | rel: 0
// CHECK: [[@LINE-1]]:7 | class(Gen,TS)/C++ | SpecializationDecl | c:@S@SpecializationDecl>#I | <no-cgname> | Decl,RelSpecialization | rel: 1
// CHECK-NEXT: RelSpecialization | SpecializationDecl | c:@ST>1#T@SpecializationDecl
// CHECK: [[@LINE-3]]:7 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | <no-cgname> | Ref | rel: 0

template<>
class SpecializationDecl<int> { };
Expand All @@ -275,8 +277,10 @@ class SpecializationDecl<int> { };

template<typename T>
class PartialSpecilizationClass<Cls, T>;
// CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | PartialSpecilizationClass | c:@ST>2#T#T@PartialSpecilizationClass | <no-cgname> | Ref | rel: 0
// CHECK-NEXT: [[@LINE-2]]:33 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref | rel: 0
// CHECK: [[@LINE-1]]:7 | class(Gen,TPS)/C++ | PartialSpecilizationClass | c:@SP>1#T@PartialSpecilizationClass>#$@S@Cls#t0.0 | <no-cgname> | Decl,RelSpecialization | rel: 1
// CHECK-NEXT: RelSpecialization | PartialSpecilizationClass | c:@ST>2#T#T@PartialSpecilizationClass
// CHECK: [[@LINE-3]]:7 | class(Gen)/C++ | PartialSpecilizationClass | c:@ST>2#T#T@PartialSpecilizationClass | <no-cgname> | Ref | rel: 0
// CHECK-NEXT: [[@LINE-4]]:33 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref | rel: 0

template<>
class PartialSpecilizationClass<Cls, Cls> : Cls { };
Expand Down

0 comments on commit c926c70

Please sign in to comment.