diff options
| author | Richard Trieu <rtrieu@google.com> | 2018-06-07 00:20:58 +0000 |
|---|---|---|
| committer | Richard Trieu <rtrieu@google.com> | 2018-06-07 00:20:58 +0000 |
| commit | 5d01406cc460f0d41955250a888a7b4e23596145 (patch) | |
| tree | 8323b2a93935924aa276db364a842354b64950e1 | |
| parent | 31800864dc1f5bb99e8b6cb62bb3bfdda126a92f (diff) | |
| download | bcm5719-llvm-5d01406cc460f0d41955250a888a7b4e23596145.tar.gz bcm5719-llvm-5d01406cc460f0d41955250a888a7b4e23596145.zip | |
[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.
llvm-svn: 334151
| -rw-r--r-- | clang/lib/AST/ODRHash.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Modules/odr_hash.cpp | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp index 7a3a6964e5b..126b6de25e4 100644 --- a/clang/lib/AST/ODRHash.cpp +++ b/clang/lib/AST/ODRHash.cpp @@ -427,7 +427,7 @@ public: void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) { Visit(D->getTemplatedDecl()); - ID.AddInteger(D->getTemplatedDecl()->getODRHash()); + AddDecl(D->getTemplatedDecl()); Inherited::VisitFunctionTemplateDecl(D); } }; diff --git a/clang/test/Modules/odr_hash.cpp b/clang/test/Modules/odr_hash.cpp index dd3952232bf..9cb177fbfce 100644 --- a/clang/test/Modules/odr_hash.cpp +++ b/clang/test/Modules/odr_hash.cpp @@ -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 { |

