Modular Codegen: Don't home always_inline functions
Since they'll likely (not always - if the address is taken, etc) be
inlined away, even at -O0, separately provided weak definitions are
likely to be unused so skip all of that.
llvm-svn: 317279
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index bf34d01..e940806 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -2270,9 +2270,11 @@
if (Writer->Context->getLangOpts().ModulesCodegen) {
// Under -fmodules-codegen, codegen is performed for all non-internal,
// non-always_inline functions.
- if (!Linkage)
- Linkage = Writer->Context->GetGVALinkageForFunction(FD);
- ModulesCodegen = *Linkage != GVA_Internal;
+ if (!FD->hasAttr<AlwaysInlineAttr>()) {
+ if (!Linkage)
+ Linkage = Writer->Context->GetGVALinkageForFunction(FD);
+ ModulesCodegen = *Linkage != GVA_Internal;
+ }
}
}
Record->push_back(ModulesCodegen);