[llvm-branch-commits] [cfe-branch] r310302 - Merging r310158:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 7 13:45:55 PDT 2017


Author: hans
Date: Mon Aug  7 13:45:55 2017
New Revision: 310302

URL: http://llvm.org/viewvc/llvm-project?rev=310302&view=rev
Log:
Merging r310158:
------------------------------------------------------------------------
r310158 | rtrieu | 2017-08-04 17:54:19 -0700 (Fri, 04 Aug 2017) | 8 lines

[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/branches/release_50/   (props changed)
    cfe/branches/release_50/lib/AST/ODRHash.cpp

Propchange: cfe/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug  7 13:45:55 2017
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:308455,308824,308897,308996,309058,309112-309113,309226,309327,309382-309383,309488,309503,309523,309722,309752,309975,310057,310191
+/cfe/trunk:308455,308824,308897,308996,309058,309112-309113,309226,309327,309382-309383,309488,309503,309523,309722,309752,309975,310057,310158,310191
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_50/lib/AST/ODRHash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/lib/AST/ODRHash.cpp?rev=310302&r1=310301&r2=310302&view=diff
==============================================================================
--- cfe/branches/release_50/lib/AST/ODRHash.cpp (original)
+++ cfe/branches/release_50/lib/AST/ODRHash.cpp Mon Aug  7 13:45:55 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);




More information about the llvm-branch-commits mailing list