#include "llvm/GlobalValue.h"
#include "llvm/OperandTraits.h"
+#include "llvm/ADT/ilist_node.h"
namespace llvm {
template<typename ValueSubClass, typename ItemParentClass>
class SymbolTableListTraits;
-class GlobalVariable : public GlobalValue {
+class GlobalVariable : public GlobalValue, public ilist_node<GlobalVariable> {
friend class SymbolTableListTraits<GlobalVariable, Module>;
void *operator new(size_t, unsigned); // Do not implement
void operator=(const GlobalVariable &); // Do not implement
void setParent(Module *parent);
- GlobalVariable *Prev, *Next;
- void setNext(GlobalVariable *N) { Next = N; }
- void setPrev(GlobalVariable *N) { Prev = N; }
-
bool isConstantGlobal : 1; // Is this a global constant?
bool isThreadLocalSymbol : 1; // Is this symbol "Thread Local"?
/// leads to undefined behavior.
///
bool isConstant() const { return isConstantGlobal; }
- void setConstant(bool Value) { isConstantGlobal = Value; }
+ void setConstant(bool Val) { isConstantGlobal = Val; }
/// If the value is "Thread Local", its value isn't shared by the threads.
bool isThreadLocal() const { return isThreadLocalSymbol; }
- void setThreadLocal(bool Value) { isThreadLocalSymbol = Value; }
+ void setThreadLocal(bool Val) { isThreadLocalSymbol = Val; }
+
+ /// copyAttributesFrom - copy all additional attributes (those not needed to
+ /// create a GlobalVariable) from the GlobalVariable Src to this one.
+ void copyAttributesFrom(const GlobalValue *Src);
/// removeFromParent - This method unlinks 'this' from the containing module,
/// but does not delete it.
static inline bool classof(const Value *V) {
return V->getValueID() == Value::GlobalVariableVal;
}
-private:
- // getNext/Prev - Return the next or previous global variable in the list.
- GlobalVariable *getNext() { return Next; }
- const GlobalVariable *getNext() const { return Next; }
- GlobalVariable *getPrev() { return Prev; }
- const GlobalVariable *getPrev() const { return Prev; }
};
template <>