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 | e9b11b431308f4766b73cda93e38ec930c912122 (patch) | |
tree | d72fc321dc0c445f8880443050c0a03c2ccdf7d2 /lib/VMCore/Globals.cpp | |
parent | 515cdbe49d9bb5cd05be2713faaa7e2a66ddc3bc (diff) | |
download | llvm-e9b11b431308f4766b73cda93e38ec930c912122.tar.gz llvm-e9b11b431308f4766b73cda93e38ec930c912122.tar.bz2 llvm-e9b11b431308f4766b73cda93e38ec930c912122.tar.xz |
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/VMCore/Globals.cpp')
-rw-r--r-- | lib/VMCore/Globals.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/VMCore/Globals.cpp b/lib/VMCore/Globals.cpp index f8c1071052..b3087f7cc4 100644 --- a/lib/VMCore/Globals.cpp +++ b/lib/VMCore/Globals.cpp @@ -97,8 +97,7 @@ void GlobalValue::copyAttributesFrom(const GlobalValue *Src) { GlobalVariable::GlobalVariable(LLVMContext &Context, const Type *Ty, bool constant, LinkageTypes Link, Constant *InitVal, const std::string &Name, - Module *ParentModule, bool ThreadLocal, - unsigned AddressSpace) + bool ThreadLocal, unsigned AddressSpace) : GlobalValue(Context.getPointerType(Ty, AddressSpace), Value::GlobalVariableVal, OperandTraits<GlobalVariable>::op_begin(this), @@ -111,18 +110,14 @@ GlobalVariable::GlobalVariable(LLVMContext &Context, const Type *Ty, } LeakDetector::addGarbageObject(this); - - if (ParentModule) - ParentModule->getGlobalList().push_back(this); } -GlobalVariable::GlobalVariable(LLVMContext &Context, const Type *Ty, - bool constant, LinkageTypes Link, - Constant *InitVal, const std::string &Name, +GlobalVariable::GlobalVariable(Module &M, const Type *Ty, bool constant, + LinkageTypes Link, Constant *InitVal, + const std::string &Name, GlobalVariable *Before, bool ThreadLocal, unsigned AddressSpace) - : GlobalValue(Context.getPointerType(Ty, AddressSpace), - Value::GlobalVariableVal, + : GlobalValue(PointerType::get(Ty, AddressSpace), Value::GlobalVariableVal, OperandTraits<GlobalVariable>::op_begin(this), InitVal != 0, Link, Name), isConstantGlobal(constant), isThreadLocalSymbol(ThreadLocal) { @@ -136,6 +131,8 @@ GlobalVariable::GlobalVariable(LLVMContext &Context, const Type *Ty, if (Before) Before->getParent()->getGlobalList().insert(Before, this); + else + M.getGlobalList().push_back(this); } void GlobalVariable::setParent(Module *parent) { |