[llvm-commits] CVS: llvm/include/llvm/GlobalValue.h

Chris Lattner lattner at cs.uiuc.edu
Sun Jul 18 17:55:30 PDT 2004



Changes in directory llvm/include/llvm:

GlobalValue.h updated: 1.17 -> 1.18

---
Log message:

Change method to return void.  Inline dtor


---
Diffs of the changes:  (+7 -5)

Index: llvm/include/llvm/GlobalValue.h
diff -u llvm/include/llvm/GlobalValue.h:1.17 llvm/include/llvm/GlobalValue.h:1.18
--- llvm/include/llvm/GlobalValue.h:1.17	Sat Jul 17 19:55:49 2004
+++ llvm/include/llvm/GlobalValue.h	Sun Jul 18 19:55:19 2004
@@ -42,7 +42,9 @@
   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 @@
   /// 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; }





More information about the llvm-commits mailing list