[ODRHash] Treat some non-templated classes as templated.

When using nested classes, if the inner class is not templated, but the outer
class is templated, the inner class will not be templated, but may have some
traits as if it were.  This is particularly evident if the inner class
refers to the outer class in some fashion.  Treat any class that is in the
context of a templated class as also a templated class.

llvm-svn: 310158
This commit is contained in:
Richard Trieu 2017-08-05 00:54:19 +00:00
parent c099010ed7
commit 5fb82efebf
1 changed files with 6 additions and 2 deletions

View File

@ -378,8 +378,12 @@ void ODRHash::AddCXXRecordDecl(const CXXRecordDecl *Record) {
assert(Record && Record->hasDefinition() &&
"Expected non-null record to be a definition.");
if (isa<ClassTemplateSpecializationDecl>(Record)) {
return;
const DeclContext *DC = Record;
while (DC) {
if (isa<ClassTemplateSpecializationDecl>(DC)) {
return;
}
DC = DC->getParent();
}
AddDecl(Record);