Add a new method, allow symtab to poke name.
authorChris Lattner <sabre@nondot.org>
Sun, 6 Mar 2005 02:10:40 +0000 (02:10 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 6 Mar 2005 02:10:40 +0000 (02:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20468 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/SymbolTable.h
include/llvm/Value.h

index 3fe4b04e19e2331caa2ea729ade9e8b7b28a8756..7df189896ee2230644a2b3a6f7183bb4c6ac982e 100644 (file)
@@ -217,6 +217,14 @@ public:
     return this->removeEntry(pmap.find(It->second->getType()), It);
   }
 
+  /// changeName - Given a value with a non-empty name, remove its existing
+  /// entry from the symbol table and insert a new one for Name.  This is
+  /// equivalent to doing "remove(V), V->Name = Name, insert(V)", but is faster,
+  /// and will not temporarily remove the symbol table plane if V is the last
+  /// value in the symtab with that name (which could invalidate iterators to
+  /// that plane).
+  void changeName(Value *V, const std::string &Name);
+
   /// This method will strip the symbol table of its names leaving
   /// the type and values. 
   /// @brief Strip the symbol table. 
index 164c7ee811c7ee50460c2b96c2e9e0138d99550e..aef08453a6f34b9d34de32ef28d3f66560c26c50 100644 (file)
@@ -50,6 +50,8 @@ protected:
 private:
   PATypeHolder Ty;
   Use *UseList;
+
+  friend class SymbolTable;    // Allow SymbolTable to directly poke Name.
   std::string Name;
 
   void operator=(const Value &);     // Do not implement