diff options
author | Chris Lattner <sabre@nondot.org> | 2001-11-26 17:01:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-11-26 17:01:18 +0000 |
commit | c267f7bcc0e123cb98cc2fa3d9149bc1cbbef370 (patch) | |
tree | b4e48179a61fa282b792583434c6a241cc4a7759 /lib/VMCore/SymbolTable.cpp | |
parent | 7c54b4a067ba181da846a4a787fa57a18fc7245b (diff) |
If a name conflict occurs when inserting a value, rename it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/SymbolTable.cpp')
-rw-r--r-- | lib/VMCore/SymbolTable.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp index 8d6df2c787..b8da428a2c 100644 --- a/lib/VMCore/SymbolTable.cpp +++ b/lib/VMCore/SymbolTable.cpp @@ -133,9 +133,14 @@ Value *SymbolTable::removeEntry(iterator Plane, type_iterator Entry) { // name... // void SymbolTable::insertEntry(const string &Name, const Type *VTy, Value *V) { - // TODO: The typeverifier should catch this when its implemented - assert(lookup(VTy, Name) == 0 && - "SymbolTable::insertEntry - Name already in symbol table!"); + // Check to see if there is a naming conflict. If so, rename this value! + if (lookup(VTy, Name)) { + string UniqueName = getUniqueName(VTy, Name); + InternallyInconsistent = true; + V->setName(UniqueName, this); + InternallyInconsistent = false; + return; + } #if DEBUG_SYMBOL_TABLE cerr << this << " Inserting definition: " << Name << ": " |