diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-07-17 23:28:28 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-07-17 23:28:28 +0000 |
commit | 118c091fd7b57cd0236c3b722e36a7a883b17b0a (patch) | |
tree | 9689343c5149c8c6e8f5c5aee7e4cebf662447c2 | |
parent | 355b0d88cbcc9690a6ecce1040e46e5adb956d58 (diff) | |
download | external_llvm-118c091fd7b57cd0236c3b722e36a7a883b17b0a.zip external_llvm-118c091fd7b57cd0236c3b722e36a7a883b17b0a.tar.gz external_llvm-118c091fd7b57cd0236c3b722e36a7a883b17b0a.tar.bz2 |
bug 122:
- derive from Constant
- declare needed overrides from Constant class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14920 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/GlobalValue.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index 03fef35..f72c474 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -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; |