1 //===-- llvm/GlobalValue.h - Class to represent a global value ---*- C++ -*--=//
3 // This file is a common base class of all globally definable objects. As such,
4 // it is subclassed by GlobalVariable and by Method. This is used because you
5 // can do certain things with these global objects that you can't do to anything
6 // else. For example, use the address of one as a constant.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_GLOBALVALUE_H
11 #define LLVM_GLOBALVALUE_H
13 #include "llvm/User.h"
16 class GlobalValue : public User {
17 GlobalValue(const GlobalValue &); // do not implement
19 GlobalValue(const Type *Ty, ValueTy vty, const string &name = "")
20 : User(Ty, vty, name) {}
23 // getType - Global values are always pointers (FIXME, methods should be ptrs too!)
24 inline const PointerType *getType() const {
25 return (const PointerType*)User::getType();
28 // Methods for support type inquiry through isa, cast, and dyn_cast:
29 static inline bool classof(const GlobalValue *T) { return true; }
30 static inline bool classof(const Value *V) {
31 return V->getValueType() == Value::MethodVal ||
32 V->getValueType() == Value::GlobalVariableVal;