aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriterDecl.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-07-13 19:25:38 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-07-13 19:25:38 +0000
commit8746d127c04f5bbaf6c6e88cef8606ca5a6a54e9 (patch)
tree84c9d77f8c764f04bcef0b1da4eedfa233d67a46 /lib/Serialization/ASTWriterDecl.cpp
parentcf1b401909b5e54edfd80656b1a18eaa31f9f6f1 (diff)
downloadsrc-8746d127c04f5bbaf6c6e88cef8606ca5a6a54e9.tar.gz
src-8746d127c04f5bbaf6c6e88cef8606ca5a6a54e9.zip
Vendor import of clang trunk r307894:vendor/clang/clang-trunk-r307894
Notes
Notes: svn path=/vendor/clang/dist/; revision=320959 svn path=/vendor/clang/clang-trunk-r307894/; revision=320960; tag=vendor/clang/clang-trunk-r307894
Diffstat (limited to 'lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r--lib/Serialization/ASTWriterDecl.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp
index 2d648cb103cb..ec21ca2276c1 100644
--- a/lib/Serialization/ASTWriterDecl.cpp
+++ b/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));