aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Module.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-08 01:26:06 +0000
committerOwen Anderson <resistor@mac.com>2009-07-08 01:26:06 +0000
commit3d29df3e8a203b167d8071ea6f805b21db18a5af (patch)
tree04e35fb85689b9621ea6ec76db47849335a87c5c /lib/VMCore/Module.cpp
parent8b8d31e3ec8c491a893307069ac123728c84782c (diff)
Push LLVMContext through GlobalVariables and IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Module.cpp')
-rw-r--r--lib/VMCore/Module.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index f057e81a64..6f3de0257e 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -28,17 +28,20 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
// Methods to implement the globals and functions lists.
+// NOTE: It is ok to allocate the globals used for these methods from the
+// global context, because all we ever do is use them to compare for equality.
//
GlobalVariable *ilist_traits<GlobalVariable>::createSentinel() {
- GlobalVariable *Ret = new GlobalVariable(Type::Int32Ty, false,
+ GlobalVariable *Ret = new GlobalVariable(getGlobalContext(),
+ Type::Int32Ty, false,
GlobalValue::ExternalLinkage);
// This should not be garbage monitored.
LeakDetector::removeGarbageObject(Ret);
return Ret;
}
GlobalAlias *ilist_traits<GlobalAlias>::createSentinel() {
- GlobalAlias *Ret = new GlobalAlias(Type::Int32Ty,
+ GlobalAlias *Ret = new GlobalAlias(Type::Int32Ty,
GlobalValue::ExternalLinkage);
// This should not be garbage monitored.
LeakDetector::removeGarbageObject(Ret);
@@ -270,7 +273,8 @@ Constant *Module::getOrInsertGlobal(const std::string &Name, const Type *Ty) {
if (GV == 0) {
// Nope, add it
GlobalVariable *New =
- new GlobalVariable(Ty, false, GlobalVariable::ExternalLinkage, 0, Name);
+ new GlobalVariable(getContext(), Ty, false,
+ GlobalVariable::ExternalLinkage, 0, Name);
GlobalList.push_back(New);
return New; // Return the new declaration.
}