summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/GlobalMerge.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-07-08 14:55:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-07-08 14:55:06 +0000
commitcccdadca45d76ebc5f1a6a7975d3c343295d8113 (patch)
treeebf8796d080ddf1e5de59476e72fd0e6ac8b3777 /llvm/lib/CodeGen/GlobalMerge.cpp
parent57fd7abd580b4eeb19c323ccf5a815f7df353aaf (diff)
downloadbcm5719-llvm-cccdadca45d76ebc5f1a6a7975d3c343295d8113.tar.gz
bcm5719-llvm-cccdadca45d76ebc5f1a6a7975d3c343295d8113.zip
Fix some Twine locals.
Two of those are use after frees. Found by clang-tidy, fixed by me. llvm-svn: 212537
Diffstat (limited to 'llvm/lib/CodeGen/GlobalMerge.cpp')
-rw-r--r--llvm/lib/CodeGen/GlobalMerge.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp
index d52fcbfa41e..5572a062912 100644
--- a/llvm/lib/CodeGen/GlobalMerge.cpp
+++ b/llvm/lib/CodeGen/GlobalMerge.cpp
@@ -199,19 +199,17 @@ bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
? GlobalValue::ExternalLinkage
: GlobalValue::InternalLinkage;
- // If merged variables have external linkage, we use symbol name of the
- // first variable merged as the suffix of global symbol name. This would
- // be able to avoid the link-time naming conflict for globalm symbols.
- Twine MergedGVName = HasExternal
- ? "_MergedGlobals_" + TheFirstExternal->getName()
- : "_MergedGlobals";
-
StructType *MergedTy = StructType::get(M.getContext(), Tys);
Constant *MergedInit = ConstantStruct::get(MergedTy, Inits);
+ // If merged variables have external linkage, we use symbol name of the
+ // first variable merged as the suffix of global symbol name. This would
+ // be able to avoid the link-time naming conflict for globalm symbols.
GlobalVariable *MergedGV = new GlobalVariable(
- M, MergedTy, isConst, Linkage, MergedInit, MergedGVName, nullptr,
- GlobalVariable::NotThreadLocal, AddrSpace);
+ M, MergedTy, isConst, Linkage, MergedInit,
+ HasExternal ? "_MergedGlobals_" + TheFirstExternal->getName()
+ : "_MergedGlobals",
+ nullptr, GlobalVariable::NotThreadLocal, AddrSpace);
for (size_t k = i; k < j; ++k) {
GlobalValue::LinkageTypes Linkage = Globals[k]->getLinkage();
OpenPOWER on IntegriCloud