diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-07-06 00:30:00 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-07-06 00:30:00 +0000 |
commit | b51cf1136fe231b45dc45713086d182b3a75e773 (patch) | |
tree | 7fa6f38d56006cf3051b6a0330aa01f8a9f8e881 /clang/lib | |
parent | 29c5f16ad028238d743f958b8205c53fad3d2e1d (diff) | |
download | bcm5719-llvm-b51cf1136fe231b45dc45713086d182b3a75e773.tar.gz bcm5719-llvm-b51cf1136fe231b45dc45713086d182b3a75e773.zip |
[modules ts] Do not emit strong function definitions from the module interface unit in every user.
llvm-svn: 307232
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 2d648cb103c..ec21ca2276c 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -2233,8 +2233,18 @@ void ASTRecordWriter::AddFunctionDefinition(const FunctionDecl *FD) { Writer->ClearSwitchCaseIDs(); assert(FD->doesThisDeclarationHaveABody()); - bool ModulesCodegen = Writer->Context->getLangOpts().ModulesCodegen && - Writer->WritingModule && !FD->isDependentContext(); + bool ModulesCodegen = false; + if (Writer->WritingModule && !FD->isDependentContext()) { + // Under -fmodules-codegen, codegen is performed for all defined functions. + // When building a C++ Modules TS module interface unit, a strong definition + // in the module interface is provided by the compilation of that module + // interface unit, not by its users. (Inline functions are still emitted + // in module users.) + ModulesCodegen = + Writer->Context->getLangOpts().ModulesCodegen || + (Writer->WritingModule->Kind == Module::ModuleInterfaceUnit && + Writer->Context->GetGVALinkageForFunction(FD) == GVA_StrongExternal); + } Record->push_back(ModulesCodegen); if (ModulesCodegen) Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(FD)); |