Author: rtrieu Date: Wed Jun 6 17:20:58 2018 New Revision: 334151 URL: http://llvm.org/viewvc/llvm-project?rev=334151&view=rev Log: [ODRHash] Adjust info stored for FunctionTemplateDecl.
Avoid storing information for definitions since those can be out-of-line and vary between modules even when the declarations are the same. 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=334151&r1=334150&r2=334151&view=diff ============================================================================== --- cfe/trunk/lib/AST/ODRHash.cpp (original) +++ cfe/trunk/lib/AST/ODRHash.cpp Wed Jun 6 17:20:58 2018 @@ -427,7 +427,7 @@ public: void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) { Visit(D->getTemplatedDecl()); - ID.AddInteger(D->getTemplatedDecl()->getODRHash()); + AddDecl(D->getTemplatedDecl()); Inherited::VisitFunctionTemplateDecl(D); } }; Modified: cfe/trunk/test/Modules/odr_hash.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/odr_hash.cpp?rev=334151&r1=334150&r2=334151&view=diff ============================================================================== --- cfe/trunk/test/Modules/odr_hash.cpp (original) +++ cfe/trunk/test/Modules/odr_hash.cpp Wed Jun 6 17:20:58 2018 @@ -3617,6 +3617,20 @@ int I10 = F10(); #endif // expected-error@second.h:* {{'FunctionDecl::F10' has different definitions in different modules; definition in module 'SecondModule' first difference is function body}} // expected-note@first.h:* {{but in 'FirstModule' found a different body}} + +#if defined(FIRST) +struct S11 { + template <int> void foo(); +}; +#elif defined(SECOND) +struct S11 { + template <int> void foo(); +}; +template <int> void S11::foo() {} +#else +S11 s11; +#endif + } // namespace FunctionDecl namespace DeclTemplateArguments { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits