aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 4fe25ff..660f18a 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -494,8 +494,12 @@ void CodeGenModule::RewriteAlwaysInlineFunction(llvm::Function *Fn) {
FindNonDirectCallUses(Fn, &NonDirectCallUses);
// Do not create the wrapper if there are no non-direct call uses, and we are
// not required to emit an external definition.
- if (NonDirectCallUses.empty() && Fn->isDiscardableIfUnused())
+ if (NonDirectCallUses.empty() && Fn->isDiscardableIfUnused()) {
+ // An always inline function with no wrapper cannot legitimately use the
+ // function's COMDAT symbol.
+ Fn->setComdat(nullptr);
return;
+ }
llvm::FunctionType *FT = Fn->getFunctionType();
llvm::LLVMContext &Ctx = getModule().getContext();