//===-- SymbolTable.cpp - Implement the SymbolTable class -----------------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and revised by Reid
-// Spencer. It is distributed under the University of Illinois Open Source
+// Spencer. It is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file implements the SymbolTable class for the VMCore library.
cast<DerivedType>(TI->second)->removeAbstractTypeUser(this);
}
- // TODO: FIXME: BIG ONE: This doesn't unreference abstract types for the
+ // TODO: FIXME: BIG ONE: This doesn't unreference abstract types for the
// planes that could still have entries!
#ifndef NDEBUG // Only do this in -g mode...
LeftoverValues = false;
}
}
-
+
assert(LeftoverValues && "Values remain in symbol table!");
#endif
}
#if DEBUG_SYMBOL_TABLE
dump();
- std::cerr << " Inserting definition: " << Name << ": "
+ std::cerr << " Inserting definition: " << Name << ": "
<< VTy->getDescription() << "\n";
#endif
#if DEBUG_SYMBOL_TABLE
dump();
- std::cerr << " Inserting type: " << UniqueName << ": "
+ std::cerr << " Inserting type: " << UniqueName << ": "
<< T->getDescription() << "\n";
#endif
value_iterator B = Plane.begin(), Bend = Plane.end();
while (B != Bend) { // Found nonempty type plane!
Value *V = B->second;
+ ++B;
if (!isa<GlobalValue>(V) || cast<GlobalValue>(V)->hasInternalLinkage()) {
// Set name to "", removing from symbol table!
V->setName("");
RemovedSymbol = true;
}
- ++B;
}
}
remove(TI++);
RemovedSymbol = true;
}
-
+
return RemovedSymbol;
}
plane_iterator NewTypeIt = pmap.find(NewType);
if (NewTypeIt == pmap.end()) { // If no plane exists, add one
NewTypeIt = pmap.insert(make_pair(NewType, ValueMap())).first;
-
+
if (NewType->isAbstract()) {
cast<DerivedType>(NewType)->addAbstractTypeUser(this);
#if DEBUG_ABSTYPE
// Ok we have two external global values. Make all uses of the new
// one use the old one...
NewGV->uncheckedReplaceAllUsesWith(ExistGV);
-
+
// Update NewGV's name, we're about the remove it from the symbol
// table.
NewGV->Name = "";
std::cerr << "Removing type " << OldType->getDescription() << "\n";
#endif
OldType->removeAbstractTypeUser(this);
-
+
I->second = (Type*)NewType; // TODO FIXME when types aren't const
if (NewType->isAbstract()) {
#if DEBUG_ABSTYPE