aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-08 19:03:57 +0000
committerOwen Anderson <resistor@mac.com>2009-07-08 19:03:57 +0000
commite17fc1d7a2bcc05efc0ebe943254b273c99d77fd (patch)
treed72fc321dc0c445f8880443050c0a03c2ccdf7d2 /lib/Transforms/Utils
parent4035307115ab3d5e9e434526c519155b65ecbae4 (diff)
downloadexternal_llvm-e17fc1d7a2bcc05efc0ebe943254b273c99d77fd.zip
external_llvm-e17fc1d7a2bcc05efc0ebe943254b273c99d77fd.tar.gz
external_llvm-e17fc1d7a2bcc05efc0ebe943254b273c99d77fd.tar.bz2
Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75025 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/CloneModule.cpp4
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp15
2 files changed, 8 insertions, 11 deletions
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp
index afebd5b..bb5f3e6 100644
--- a/lib/Transforms/Utils/CloneModule.cpp
+++ b/lib/Transforms/Utils/CloneModule.cpp
@@ -56,11 +56,11 @@ Module *llvm::CloneModule(const Module *M,
//
for (Module::const_global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I) {
- GlobalVariable *GV = new GlobalVariable(M->getContext(),
+ GlobalVariable *GV = new GlobalVariable(*New,
I->getType()->getElementType(),
false,
GlobalValue::ExternalLinkage, 0,
- I->getName(), New);
+ I->getName());
GV->setAlignment(I->getAlignment());
ValueMap[I] = GV;
}
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index 1eefdc4..8ef060a 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -139,11 +139,10 @@ bool LowerInvoke::doInitialization(Module &M) {
// Now that we've done that, insert the jmpbuf list head global, unless it
// already exists.
if (!(JBListHead = M.getGlobalVariable("llvm.sjljeh.jblist", PtrJBList))) {
- JBListHead = new GlobalVariable(M.getContext(),
- PtrJBList, false,
+ JBListHead = new GlobalVariable(M, PtrJBList, false,
GlobalValue::LinkOnceAnyLinkage,
Context->getNullValue(PtrJBList),
- "llvm.sjljeh.jblist", &M);
+ "llvm.sjljeh.jblist");
}
// VisualStudio defines setjmp as _setjmp via #include <csetjmp> / <setjmp.h>,
@@ -183,10 +182,9 @@ void LowerInvoke::createAbortMessage(Module *M) {
Context->getConstantArray("ERROR: Exception thrown, but not caught!\n");
AbortMessageLength = Msg->getNumOperands()-1; // don't include \0
- GlobalVariable *MsgGV = new GlobalVariable(M->getContext(),
- Msg->getType(), true,
+ GlobalVariable *MsgGV = new GlobalVariable(*M, Msg->getType(), true,
GlobalValue::InternalLinkage,
- Msg, "abortmsg", M);
+ Msg, "abortmsg");
std::vector<Constant*> GEPIdx(2, Context->getNullValue(Type::Int32Ty));
AbortMessage = Context->getConstantExprGetElementPtr(MsgGV, &GEPIdx[0], 2);
} else {
@@ -197,10 +195,9 @@ void LowerInvoke::createAbortMessage(Module *M) {
"Recompile program with -enable-correct-eh-support.\n");
AbortMessageLength = Msg->getNumOperands()-1; // don't include \0
- GlobalVariable *MsgGV = new GlobalVariable(M->getContext(),
- Msg->getType(), true,
+ GlobalVariable *MsgGV = new GlobalVariable(*M, Msg->getType(), true,
GlobalValue::InternalLinkage,
- Msg, "abortmsg", M);
+ Msg, "abortmsg");
std::vector<Constant*> GEPIdx(2, Context->getNullValue(Type::Int32Ty));
AbortMessage = ConstantExpr::getGetElementPtr(MsgGV, &GEPIdx[0], 2);
}