aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-07-20 20:35:30 +0000
committerReid Kleckner <reid@kleckner.net>2015-07-20 20:35:30 +0000
commiteab97d3d47e24f208b964fb4a15475836a33ba82 (patch)
treeac50590df345c7c52349d664d0ca43bf732146cd /clang/lib/CodeGen/CGDecl.cpp
parent93d608c3c3ecc7ce55a4b7f3281240a864f11b1c (diff)
downloadllvm-eab97d3d47e24f208b964fb4a15475836a33ba82.zip
llvm-eab97d3d47e24f208b964fb4a15475836a33ba82.tar.gz
llvm-eab97d3d47e24f208b964fb4a15475836a33ba82.tar.bz2
Fix a case where we forgot to make a static local variable comdat
Sometimes we can provide an initializer for static locals, in which case we sometimes might need to change the type. Changing the type requires making a new LLVM GlobalVariable, and in this codepath we were forgetting to transfer the comdat. Fixes PR23838. Patch by Ivan Garramona. llvm-svn: 242704
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 96aa8c6..ebd1776 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -311,6 +311,7 @@ CodeGenFunction::AddInitializerToStaticVarDecl(const VarDecl &D,
OldGV->getThreadLocalMode(),
CGM.getContext().getTargetAddressSpace(D.getType()));
GV->setVisibility(OldGV->getVisibility());
+ GV->setComdat(OldGV->getComdat());
// Steal the name of the old global
GV->takeName(OldGV);