- derive from Constant
- declare needed overrides from Constant class

llvm-svn: 14920
This commit is contained in:
Reid Spencer 2004-07-17 23:28:28 +00:00
parent 51fd2506ad
commit bedeb65525

View File

@ -17,14 +17,14 @@
#ifndef LLVM_GLOBALVALUE_H
#define LLVM_GLOBALVALUE_H
#include "llvm/User.h"
#include "llvm/Constant.h"
namespace llvm {
class PointerType;
class Module;
class GlobalValue : public User {
class GlobalValue : public Constant {
GlobalValue(const GlobalValue &); // do not implement
public:
enum LinkageTypes {
@ -37,12 +37,19 @@ public:
protected:
GlobalValue(const Type *Ty, ValueTy vty, LinkageTypes linkage,
const std::string &name = "")
: User(Ty, vty, name), Linkage(linkage), Parent(0) {}
: Constant(Ty, vty, name), Linkage(linkage), Parent(0) { }
LinkageTypes Linkage; // The linkage of this global
Module *Parent;
public:
~GlobalValue() {}
virtual ~GlobalValue();
/// If the usage is empty (except transitively dead constants), then this
/// global value can can be safely deleted since the destructor wll
/// delete the dead constants as well.
/// @brief Determine if theusage of this global value is empty except
/// for transitively dead constants.
bool use_empty_except_constants();
/// getType - Global values are always pointers.
inline const PointerType *getType() const {
@ -57,6 +64,13 @@ public:
void setLinkage(LinkageTypes LT) { Linkage = LT; }
LinkageTypes getLinkage() const { return Linkage; }
/// Override from Constant class. No GlobalValue's have null values so
/// this always returns false.
virtual bool isNullValue() const { return false; }
/// Override from Constant class.
virtual void destroyConstant();
/// isExternal - Return true if the primary definition of this global value is
/// outside of the current translation unit...
virtual bool isExternal() const = 0;