diff options
-rw-r--r-- | include/llvm/SymbolTable.h | 8 | ||||
-rw-r--r-- | include/llvm/Value.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/SymbolTable.h b/include/llvm/SymbolTable.h index 3fe4b04e19..7df189896e 100644 --- a/include/llvm/SymbolTable.h +++ b/include/llvm/SymbolTable.h @@ -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. diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 164c7ee811..aef08453a6 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -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 |