Remove obsolete method
[oota-llvm.git] / lib / VMCore / SymbolTable.cpp
index 9452cdfec4397ec2473b823cf1568ceaacc0265e..be1459e70b713261f7f84284a079635a72a0ede2 100644 (file)
@@ -16,6 +16,7 @@
 #include "llvm/Module.h"
 #include "Support/StringExtras.h"
 #include <algorithm>
+using namespace llvm;
 
 #define DEBUG_SYMBOL_TABLE 0
 #define DEBUG_ABSTYPE 0
@@ -71,10 +72,10 @@ std::string SymbolTable::getUniqueName(const Type *Ty,
 
 
 // lookup - Returns null on failure...
-Value *SymbolTable::lookup(const Type *Ty, const std::string &Name) {
-  iterator I = find(Ty);
+Value *SymbolTable::lookup(const Type *Ty, const std::string &Name) const {
+  const_iterator I = find(Ty);
   if (I != end()) {                      // We have symbols in that plane...
-    type_iterator J = I->second.find(Name);
+    type_const_iterator J = I->second.find(Name);
     if (J != I->second.end())            // and the name is in our hash table...
       return J->second;
   }
@@ -269,6 +270,13 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
           else
             M->getGlobalList().remove(cast<GlobalVariable>(NewGV));
           delete NewGV;
+        } else {
+          // If they are not global values, they must be just random values who
+          // happen to conflict now that types have been resolved.  If this is
+          // the case, reinsert the value into the new plane, allowing it to get
+          // renamed.
+          assert(V.second->getType() == NewType &&"Type resolution is broken!");
+          insert(V.second);
         }
       } else {
         insertEntry(V.first, NewType, V.second);