Add long overdue methods
authorChris Lattner <sabre@nondot.org>
Mon, 11 Oct 2004 22:21:13 +0000 (22:21 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 11 Oct 2004 22:21:13 +0000 (22:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16921 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/BasicBlock.h
include/llvm/Function.h
include/llvm/GlobalVariable.h
include/llvm/Instruction.h

index 9c82da266ef49cd476a7843430b2b60e705c5f12..2a18ba837ed30e14befe9eb6ee9db21dde7c5f30 100644 (file)
@@ -95,6 +95,18 @@ public:
   TerminatorInst *getTerminator();
   const TerminatorInst *const getTerminator() const;
   
+  /// removeFromParent - This method unlinks 'this' from the containing
+  /// function, but does not delete it.
+  ///
+  void removeFromParent();
+
+  /// eraseFromParent - This method unlinks 'this' from the containing function
+  /// and deletes it.
+  ///
+  void eraseFromParent();
+
+
+
   //===--------------------------------------------------------------------===//
   /// Instruction iterator methods
   ///
index 9e17f2602cce8678c14bf6de86407bb24fc9fb3f..63b533461a3ceb6a64986834543c6facb97a3dc8 100644 (file)
@@ -114,6 +114,17 @@ public:
     setLinkage(ExternalLinkage);
   }
 
+  /// removeFromParent - This method unlinks 'this' from the containing module,
+  /// but does not delete it.
+  ///
+  void removeFromParent();
+
+  /// eraseFromParent - This method unlinks 'this' from the containing module
+  /// and deletes it.
+  ///
+  void eraseFromParent();
+
+
   // getNext/Prev - Return the next or previous function in the list.  These
   // methods should never be used directly, and are only used to implement the
   // function list as part of the module.
index dd6f24d7d032c2364331fcdaa494e4b5c5fc7266..99c39f179602c91c77686bff6cd0c2e8f7aaf954 100644 (file)
@@ -97,6 +97,16 @@ public:
   ///
   bool isConstant() const { return isConstantGlobal; }
   void setConstant(bool Value) { isConstantGlobal = Value; }
+
+  /// removeFromParent - This method unlinks 'this' from the containing module,
+  /// but does not delete it.
+  ///
+  void removeFromParent();
+
+  /// eraseFromParent - This method unlinks 'this' from the containing module
+  /// and deletes it.
+  ///
+  void eraseFromParent();
   
   /// Override Constant's implementation of this method so we can 
   /// replace constant initializers.
index 85f6cdb0b144ccc0bf8d17a043e16a736ac5b4e7..8d49870e4d32398e49175e73d3cdfa51ac592ba7 100644 (file)
@@ -57,6 +57,10 @@ public:
   // Specialize setName to handle symbol table majik...
   virtual void setName(const std::string &name, SymbolTable *ST = 0);
   
+  /// mayWriteToMemory - Return true if this instruction may modify memory.
+  ///
+  virtual bool mayWriteToMemory() const { return false; }
+
   /// clone() - Create a copy of 'this' instruction that is identical in all
   /// ways except the following:
   ///   * The instruction has no parent
@@ -76,9 +80,15 @@ public:
         Instruction *getPrev()       { return Prev; }
   const Instruction *getPrev() const { return Prev; }
 
-  /// mayWriteToMemory - Return true if this instruction may modify memory.
+  /// removeFromParent - This method unlinks 'this' from the containing basic
+  /// block, but does not delete it.
   ///
-  virtual bool mayWriteToMemory() const { return false; }
+  void removeFromParent();
+
+  /// eraseFromParent - This method unlinks 'this' from the containing basic
+  /// block and deletes it.
+  ///
+  void eraseFromParent();
 
   // ---------------------------------------------------------------------------
   /// Subclass classification... getOpcode() returns a member of