diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-08 19:03:57 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-08 19:03:57 +0000 |
commit | b17f32945fa6dd8e552a16cc5273bba5805cf4e4 (patch) | |
tree | b8383165ab804187660d5c8eddb2dc7486730b93 /llvm/lib/VMCore/Module.cpp | |
parent | d5ffa8ffb62df34c6fa3ba8ec4c29b2ea2891ad0 (diff) | |
download | bcm5719-llvm-b17f32945fa6dd8e552a16cc5273bba5805cf4e4.tar.gz bcm5719-llvm-b17f32945fa6dd8e552a16cc5273bba5805cf4e4.zip |
Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
llvm-svn: 75025
Diffstat (limited to 'llvm/lib/VMCore/Module.cpp')
-rw-r--r-- | llvm/lib/VMCore/Module.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp index 6f3de0257e4..87398489616 100644 --- a/llvm/lib/VMCore/Module.cpp +++ b/llvm/lib/VMCore/Module.cpp @@ -28,20 +28,17 @@ 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(getGlobalContext(), - Type::Int32Ty, false, - GlobalValue::ExternalLinkage); + 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); @@ -273,10 +270,9 @@ Constant *Module::getOrInsertGlobal(const std::string &Name, const Type *Ty) { if (GV == 0) { // Nope, add it GlobalVariable *New = - new GlobalVariable(getContext(), Ty, false, - GlobalVariable::ExternalLinkage, 0, Name); - GlobalList.push_back(New); - return New; // Return the new declaration. + new GlobalVariable(*this, Ty, false, GlobalVariable::ExternalLinkage, + 0, Name); + return New; // Return the new declaration. } // If the variable exists but has the wrong type, return a bitcast to the |