X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FGlobalVariable.h;h=633e8b4dc335af68b2d1188b50c68fb21ad007ee;hb=bd8227f5298f0ab7b96203a6d3875e5d26573376;hp=428ce90fefcd933e4097f47e3fe2b89392c72329;hpb=7b550ccfc5a3346c17e0390a59e2d6d19bc52705;p=oota-llvm.git diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h index 428ce90fefc..633e8b4dc33 100644 --- a/include/llvm/GlobalVariable.h +++ b/include/llvm/GlobalVariable.h @@ -23,6 +23,7 @@ #include "llvm/GlobalValue.h" #include "llvm/OperandTraits.h" #include "llvm/ADT/ilist_node.h" +#include "llvm/ADT/Twine.h" namespace llvm { @@ -99,18 +100,10 @@ public: assert(hasInitializer() && "GV doesn't have initializer!"); return static_cast(Op<0>().get()); } - inline void setInitializer(Constant *CPV) { - if (CPV == 0) { - if (hasInitializer()) { - Op<0>().set(0); - NumOperands = 0; - } - } else { - if (!hasInitializer()) - NumOperands = 1; - Op<0>().set(CPV); - } - } + /// setInitializer - Sets the initializer for this global variable, removing + /// any existing initializer if InitVal==NULL. If this GV has type T*, the + /// initializer must have type T. + void setInitializer(Constant *InitVal); /// If the value is a global constant, its value is immutable throughout the /// runtime execution of the program. Assigning a value into the constant