aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/SymbolTable.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-03 19:28:15 +0000
committerChris Lattner <sabre@nondot.org>2001-10-03 19:28:15 +0000
commit4387370c1c6dd64ad01be0fc91836616d908e917 (patch)
treebb7a8e03db70bb1140ee30677acd097baa8c1a29 /lib/VMCore/SymbolTable.cpp
parent6a57baa295bb3dbd389581df968536f594709bdb (diff)
downloadexternal_llvm-4387370c1c6dd64ad01be0fc91836616d908e917.zip
external_llvm-4387370c1c6dd64ad01be0fc91836616d908e917.tar.gz
external_llvm-4387370c1c6dd64ad01be0fc91836616d908e917.tar.bz2
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
Diffstat (limited to 'lib/VMCore/SymbolTable.cpp')
-rw-r--r--lib/VMCore/SymbolTable.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp
index 12bf0c7..0946530 100644
--- a/lib/VMCore/SymbolTable.cpp
+++ b/lib/VMCore/SymbolTable.cpp
@@ -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