Author: rtrieu Date: Fri Aug 4 17:54:19 2017 New Revision: 310158 URL: http://llvm.org/viewvc/llvm-project?rev=310158&view=rev Log: [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. Modified: cfe/trunk/lib/AST/ODRHash.cpp Modified: cfe/trunk/lib/AST/ODRHash.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=310158&r1=310157&r2=310158&view=diff ============================================================================== --- cfe/trunk/lib/AST/ODRHash.cpp (original) +++ cfe/trunk/lib/AST/ODRHash.cpp Fri Aug 4 17:54:19 2017 @@ -378,8 +378,12 @@ void ODRHash::AddCXXRecordDecl(const CXX 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); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits