Author: rtrieu
Date: Tue Jun 13 22:17:26 2017
New Revision: 305361

URL: http://llvm.org/viewvc/llvm-project?rev=305361&view=rev
Log:
[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.

Modified:
    cfe/trunk/lib/AST/ODRHash.cpp
    cfe/trunk/test/Modules/odr_hash.cpp

Modified: cfe/trunk/lib/AST/ODRHash.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=305361&r1=305360&r2=305361&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ODRHash.cpp (original)
+++ cfe/trunk/lib/AST/ODRHash.cpp Tue Jun 13 22:17:26 2017
@@ -150,13 +150,16 @@ void ODRHash::AddTemplateArgument(Templa
     case TemplateArgument::Declaration:
     case TemplateArgument::NullPtr:
     case TemplateArgument::Integral:
+      break;
     case TemplateArgument::Template:
     case TemplateArgument::TemplateExpansion:
+      AddTemplateName(TA.getAsTemplateOrTemplatePattern());
       break;
     case TemplateArgument::Expression:
       AddStmt(TA.getAsExpr());
       break;
     case TemplateArgument::Pack:
+      llvm_unreachable("Pack");
       break;
   }
 }

Modified: cfe/trunk/test/Modules/odr_hash.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/odr_hash.cpp?rev=305361&r1=305360&r2=305361&view=diff
==============================================================================
--- cfe/trunk/test/Modules/odr_hash.cpp (original)
+++ cfe/trunk/test/Modules/odr_hash.cpp Tue Jun 13 22:17:26 2017
@@ -1051,6 +1051,24 @@ S3 s3;
 // expected-note@first.h:* {{but in 'FirstModule' found type alias 'T' with 
different underlying type 'U3<2>'}}
 #endif
 
+#if defined(FIRST)
+template<class> struct T4a {};
+template <template <class> class T> struct U4 {};
+struct S4 {
+  U4<T4a> x;
+};
+#elif defined(SECOND)
+template<class> struct T4b {};
+template <template <class> class T> struct U4 {};
+struct S4 {
+  U4<T4b> x;
+};
+#else
+S4 s4;
+// expected-error@first.h:* {{'TemplateArgument::S4::x' from module 
'FirstModule' is not present in definition of 'TemplateArgument::S4' in module 
'SecondModule'}}
+// expected-note@second.h:* {{declaration of 'x' does not match}}
+#endif
+
 }
 
 // Interesting cases that should not cause errors.  struct S should not error


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to