aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/SymbolTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/SymbolTable.cpp')
-rw-r--r--lib/VMCore/SymbolTable.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp
index bebc26c..9def6cb 100644
--- a/lib/VMCore/SymbolTable.cpp
+++ b/lib/VMCore/SymbolTable.cpp
@@ -195,7 +195,7 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
// Search to see if we have any values of the type oldtype. If so, we need to
// move them into the newtype plane...
iterator TPI = find(OldType);
- if (OldType != NewType && TPI != end()) {
+ if (TPI != end()) {
// Get a handle to the new type plane...
iterator NewTypeIt = find(NewType);
if (NewTypeIt == super::end()) { // If no plane exists, add one
@@ -281,12 +281,6 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
// Remove the plane that is no longer used
erase(TPI);
- } else if (TPI != end()) {
- assert(OldType == NewType);
-#if DEBUG_ABSTYPE
- std::cerr << "Removing SELF type " << OldType->getDescription() << "\n";
-#endif
- OldType->removeAbstractTypeUser(this);
}
TPI = find(Type::TypeTy);
@@ -315,6 +309,27 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
}
}
+void SymbolTable::typeBecameConcrete(const DerivedType *AbsTy) {
+ iterator TPI = find(AbsTy);
+
+ // If there are any values in the symbol table of this type, then the type
+ // plan is a use of the abstract type which must be dropped.
+ if (TPI != end())
+ AbsTy->removeAbstractTypeUser(this);
+
+ TPI = find(Type::TypeTy);
+ if (TPI != end()) {
+ // Loop over all of the types in the symbol table, dropping any abstract
+ // type user entries for AbsTy which occur because there are names for the
+ // type.
+ //
+ VarMap &TyPlane = TPI->second;
+ for (VarMap::iterator I = TyPlane.begin(), E = TyPlane.end(); I != E; ++I)
+ if (I->second == (Value*)AbsTy) // FIXME when Types aren't const.
+ AbsTy->removeAbstractTypeUser(this);
+ }
+}
+
static void DumpVal(const std::pair<const std::string, Value *> &V) {
std::cout << " '" << V.first << "' = ";
V.second->dump();