forked from OSchip/llvm-project
Properly match instantiations of member function templates to the function templates from which they were instantiated
llvm-svn: 82969
This commit is contained in:
parent
e0c5313493
commit
14d1bf4361
|
@ -1222,6 +1222,19 @@ static bool isInstantiationOf(ClassTemplateDecl *Pattern,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isInstantiationOf(FunctionTemplateDecl *Pattern,
|
||||||
|
FunctionTemplateDecl *Instance) {
|
||||||
|
Pattern = Pattern->getCanonicalDecl();
|
||||||
|
|
||||||
|
do {
|
||||||
|
Instance = Instance->getCanonicalDecl();
|
||||||
|
if (Pattern == Instance) return true;
|
||||||
|
Instance = Instance->getInstantiatedFromMemberTemplate();
|
||||||
|
} while (Instance);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool isInstantiationOf(CXXRecordDecl *Pattern,
|
static bool isInstantiationOf(CXXRecordDecl *Pattern,
|
||||||
CXXRecordDecl *Instance) {
|
CXXRecordDecl *Instance) {
|
||||||
Pattern = Pattern->getCanonicalDecl();
|
Pattern = Pattern->getCanonicalDecl();
|
||||||
|
@ -1309,6 +1322,9 @@ static bool isInstantiationOf(ASTContext &Ctx, NamedDecl *D, Decl *Other) {
|
||||||
if (ClassTemplateDecl *Temp = dyn_cast<ClassTemplateDecl>(Other))
|
if (ClassTemplateDecl *Temp = dyn_cast<ClassTemplateDecl>(Other))
|
||||||
return isInstantiationOf(cast<ClassTemplateDecl>(D), Temp);
|
return isInstantiationOf(cast<ClassTemplateDecl>(D), Temp);
|
||||||
|
|
||||||
|
if (FunctionTemplateDecl *Temp = dyn_cast<FunctionTemplateDecl>(Other))
|
||||||
|
return isInstantiationOf(cast<FunctionTemplateDecl>(D), Temp);
|
||||||
|
|
||||||
if (FieldDecl *Field = dyn_cast<FieldDecl>(Other)) {
|
if (FieldDecl *Field = dyn_cast<FieldDecl>(Other)) {
|
||||||
if (!Field->getDeclName()) {
|
if (!Field->getDeclName()) {
|
||||||
// This is an unnamed field.
|
// This is an unnamed field.
|
||||||
|
|
Loading…
Reference in New Issue