aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-19 00:55:19 +0000
committerChris Lattner <sabre@nondot.org>2004-07-19 00:55:19 +0000
commitf962ac798a87bbb04df1d5518454f25cca172d9b (patch)
tree840e16789af80d5200918ca5435eedbcd02f2666
parente30ab88209055558c6a607e366d8a29c886fdbee (diff)
Change method to return void. Inline dtor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14982 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/GlobalValue.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h
index d97c3677a4..bba6ff1111 100644
--- a/include/llvm/GlobalValue.h
+++ b/include/llvm/GlobalValue.h
@@ -42,7 +42,9 @@ protected:
LinkageTypes Linkage; // The linkage of this global
Module *Parent;
public:
- virtual ~GlobalValue();
+ ~GlobalValue() {
+ removeDeadConstantUsers(); // remove any dead constants using this.
+ }
/// If the usage is empty (except transitively dead constants), then this
/// global value can can be safely deleted since the destructor will
@@ -85,10 +87,10 @@ public:
/// that want to check to see if a global is unused, but don't want to deal
/// with potentially dead constants hanging off of the globals.
///
- /// This function returns true if the global value is now dead. If all
- /// users of this global are not dead, this method may return false and
- /// leave some of them around.
- bool removeDeadConstantUsers();
+ /// This method tries to make the global dead. If it detects a user that
+ /// would prevent it from becoming completely dead, it gives up early,
+ /// potentially leaving some dead constant users around.
+ void removeDeadConstantUsers();
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const GlobalValue *T) { return true; }