forked from OSchip/llvm-project
[index] The references to member enums from template instantiations should
refer to the pattern member enum in the base template rdar://32325459 llvm-svn: 303650
This commit is contained in:
parent
078b301bcc
commit
9d60520608
|
@ -127,6 +127,9 @@ bool IndexingContext::isTemplateImplicitInstantiation(const Decl *D) {
|
|||
} else if (const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
|
||||
if (RD->getInstantiatedFromMemberClass())
|
||||
TKind = RD->getTemplateSpecializationKind();
|
||||
} else if (const auto *ED = dyn_cast<EnumDecl>(D)) {
|
||||
if (ED->getInstantiatedFromMemberEnum())
|
||||
TKind = ED->getTemplateSpecializationKind();
|
||||
} else if (isa<FieldDecl>(D) || isa<TypedefNameDecl>(D)) {
|
||||
if (const auto *Parent = dyn_cast<Decl>(D->getDeclContext()))
|
||||
return isTemplateImplicitInstantiation(Parent);
|
||||
|
@ -177,6 +180,8 @@ static const Decl *adjustTemplateImplicitInstantiation(const Decl *D) {
|
|||
return VD->getTemplateInstantiationPattern();
|
||||
} else if (const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
|
||||
return RD->getInstantiatedFromMemberClass();
|
||||
} else if (const auto *ED = dyn_cast<EnumDecl>(D)) {
|
||||
return ED->getInstantiatedFromMemberEnum();
|
||||
} else if (isa<FieldDecl>(D) || isa<TypedefNameDecl>(D)) {
|
||||
const auto *ND = cast<NamedDecl>(D);
|
||||
if (const CXXRecordDecl *Pattern =
|
||||
|
|
|
@ -42,6 +42,11 @@ public:
|
|||
|
||||
typedef int Typedef;
|
||||
// CHECK: [[@LINE-1]]:17 | type-alias/C | Typedef | c:{{.*}}index-instantiated-source.cpp@ST>2#T#T@TemplateClass@S@NestedType@T@Typedef |
|
||||
|
||||
enum Enum {
|
||||
// CHECK: [[@LINE-1]]:10 | enum/C | Enum | c:@ST>2#T#T@TemplateClass@S@NestedType@E@Enum |
|
||||
EnumCase
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -74,4 +79,7 @@ void canonicalizeInstaniationReferences(TemplateClass<int, float> &object) {
|
|||
// CHECK: [[@LINE-1]]:19 | type-alias/C++ | TypeAlias | c:@ST>2#T#T@TemplateClass@S@NestedType@TypeAlias |
|
||||
TT::NestedType::Typedef nestedTypedef;
|
||||
// CHECK: [[@LINE-1]]:19 | type-alias/C | Typedef | c:{{.*}}index-instantiated-source.cpp@ST>2#T#T@TemplateClass@S@NestedType@T@Typedef |
|
||||
|
||||
TT::NestedType::Enum nestedEnum;
|
||||
// CHECK: [[@LINE-1]]:19 | enum/C | Enum | c:@ST>2#T#T@TemplateClass@S@NestedType@E@Enum |
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue