diff options
author | Chris Lattner <sabre@nondot.org> | 2005-01-29 00:33:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-01-29 00:33:00 +0000 |
commit | 5181ac8081dd6c7d78613a5da8829f81a81e9e63 (patch) | |
tree | 7bc8f0d166a4dd2e175fa56ce3a5a98093d2a291 /include/llvm/GlobalVariable.h | |
parent | ec285706aedd7027ec09a53bda9f2a8d919489cf (diff) | |
download | llvm-5181ac8081dd6c7d78613a5da8829f81a81e9e63.tar.gz llvm-5181ac8081dd6c7d78613a5da8829f81a81e9e63.tar.bz2 llvm-5181ac8081dd6c7d78613a5da8829f81a81e9e63.tar.xz |
Adjust to changes in the User class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19888 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/GlobalVariable.h')
-rw-r--r-- | include/llvm/GlobalVariable.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h index 99c39f1796..1a951774fd 100644 --- a/include/llvm/GlobalVariable.h +++ b/include/llvm/GlobalVariable.h @@ -41,6 +41,8 @@ class GlobalVariable : public GlobalValue { void setPrev(GlobalVariable *N) { Prev = N; } bool isConstantGlobal; // Is this a global constant? + Use Initializer; + public: /// GlobalVariable ctor - If a parent module is specified, the global is /// automatically inserted into the end of the specified modules global list. @@ -56,11 +58,11 @@ public: /// global variable is defined in some other translation unit, and is thus /// externally defined here. /// - virtual bool isExternal() const { return Operands.empty(); } + virtual bool isExternal() const { return getNumOperands() == 0; } /// hasInitializer - Unless a global variable isExternal(), it has an /// initializer. The initializer for the global variable/constant is held by - /// Operands[0] if an initializer is specified. + /// Initializer if an initializer is specified. /// inline bool hasInitializer() const { return !isExternal(); } @@ -70,18 +72,22 @@ public: /// inline Constant *getInitializer() const { assert(hasInitializer() && "GV doesn't have initializer!"); - return reinterpret_cast<Constant*>(Operands[0].get()); + return reinterpret_cast<Constant*>(Initializer.get()); } inline Constant *getInitializer() { assert(hasInitializer() && "GV doesn't have initializer!"); - return reinterpret_cast<Constant*>(Operands[0].get()); + return reinterpret_cast<Constant*>(Initializer.get()); } inline void setInitializer(Constant *CPV) { if (CPV == 0) { - if (hasInitializer()) Operands.pop_back(); + if (hasInitializer()) { + Initializer.set(0); + NumOperands = 0; + } } else { - if (!hasInitializer()) Operands.push_back(Use(0, this)); - Operands[0] = reinterpret_cast<Value*>(CPV); + if (!hasInitializer()) + NumOperands = 1; + Initializer.set(CPV); } } |