diff options
Diffstat (limited to 'clang/lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 50c538558e2..8205d60ca72 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -2122,11 +2122,11 @@ static bool isRequiredDecl(const Decl *D, ASTContext &Context, D->hasAttr<OMPDeclareTargetDeclAttr>()) return true; - // ImportDecl is used by codegen to determine the set of imported modules to - // search for inputs for automatic linking; include it if it has a semantic - // effect. - if (isa<ImportDecl>(D) && !WritingModule) - return true; + if (WritingModule && (isa<VarDecl>(D) || isa<ImportDecl>(D))) { + // These declarations are part of the module initializer, and are emitted + // if and when the module is imported, rather than being emitted eagerly. + return false; + } return Context.DeclMustBeEmitted(D); } |