diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-02-05 23:37:13 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-02-05 23:37:13 +0000 |
commit | 520a37f52ff159636e25eb30178aa14f0499bddc (patch) | |
tree | 577816c71a89f0fbd74d65d5c04071f9d39635e7 /clang/lib/AST/TextNodeDumper.cpp | |
parent | 53ae55a207ad3c9b94297bcc2682db1ec0f8b43b (diff) | |
download | bcm5719-llvm-520a37f52ff159636e25eb30178aa14f0499bddc.tar.gz bcm5719-llvm-520a37f52ff159636e25eb30178aa14f0499bddc.zip |
[modules] Fix handling of initializers for templated global variables.
For global variables with unordered initialization that are instantiated
within a module, we previously did not emit the global (or its
initializer) at all unless it was used in the importing translation unit
(and sometimes not even then!), leading to misbehavior and link errors.
We now emit the initializer for an instantiated global variable with
unordered initialization with side-effects in a module into every
translation unit that imports the module. This is unfortunate, but
mostly matches the behavior of a non-modular compilation and seems to be
the best that we can reasonably do.
llvm-svn: 353240
Diffstat (limited to 'clang/lib/AST/TextNodeDumper.cpp')
-rw-r--r-- | clang/lib/AST/TextNodeDumper.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp index 9e6f7216e5f..86219d24667 100644 --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -1377,6 +1377,10 @@ void TextNodeDumper::VisitCapturedDecl(const CapturedDecl *D) { void TextNodeDumper::VisitImportDecl(const ImportDecl *D) { OS << ' ' << D->getImportedModule()->getFullModuleName(); + + for (Decl *InitD : + D->getASTContext().getModuleInitializers(D->getImportedModule())) + dumpDeclRef(InitD, "initializer"); } void TextNodeDumper::VisitPragmaCommentDecl(const PragmaCommentDecl *D) { |