const Type *VTy = V->getType();
// TODO: The typeverifier should catch this when its implemented
- if (lookup(VTy, Name)) {
- cerr << "SymbolTable ERROR: Name already in symbol table: '"
- << Name << "' for type '" << VTy->getDescription() << "'\n";
- abort(); // TODO: REMOVE THIS
- }
+ assert(lookup(VTy, Name) == 0 &&
+ "SymbolTable::insertEntry - Name already in symbol table!");
#if DEBUG_SYMBOL_TABLE
cerr << this << " Inserting definition: " << Name << ": "
cast<const DerivedType>(NewType)->addAbstractTypeUser(this);
}
}
+
+
+#ifndef NDEBUG
+#include "llvm/Assembly/Writer.h"
+#include <algorithm>
+
+static void DumpVal(const pair<const string, Value *> &V) {
+ cout << " '%" << V.first << "' = " << V.second << endl;
+}
+
+static void DumpPlane(const pair<const Type *, map<const string, Value *> >&P) {
+ cout << " Plane: " << P.first << endl;
+ for_each(P.second.begin(), P.second.end(), DumpVal);
+}
+
+void SymbolTable::dump() const {
+ cout << "Symbol table dump:\n";
+ for_each(begin(), end(), DumpPlane);
+
+ if (ParentSymTab) {
+ cout << "Parent ";
+ ParentSymTab->dump();
+ }
+}
+
+#endif