Factor parentness out of Module & GlobalVariable into GlobalValue

Implement SymbolTable debug/dump utility


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@710 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-10-03 19:28:15 +00:00
parent 6a57baa295
commit 4387370c1c
8 changed files with 47 additions and 20 deletions

View File

@@ -173,3 +173,29 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
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