add a new form of Type::dump that takes a module for type names,
authorChris Lattner <sabre@nondot.org>
Wed, 1 Oct 2008 20:16:19 +0000 (20:16 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 1 Oct 2008 20:16:19 +0000 (20:16 +0000)
patch provided by Tomas Lindquist Olsen!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56929 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Type.h
lib/VMCore/AsmWriter.cpp

index 1f271957df7d6bcfddaf8c0a57ef6a3c8e9f1884..b8f65582ba333f9985fdac854edd3d453706f8de 100644 (file)
@@ -26,6 +26,7 @@ class PointerType;
 class IntegerType;
 class TypeMapBase;
 class raw_ostream;
+class Module;
 
 /// This file contains the declaration of the Type class.  For more "Type" type
 /// stuff, look in DerivedTypes.h.
@@ -162,6 +163,10 @@ public:
   /// @brief Debugging support: print to stderr
   void dump() const;
 
+  /// @brief Debugging support: print to stderr (use type names from context
+  /// module).
+  void dump(const Module *Context) const;
+
   //===--------------------------------------------------------------------===//
   // Property accessors for dealing with types... Some of these virtual methods
   // are defined in private classes defined in Type.cpp for primitive types.
index 5d765a4c658ef0bec06a868215468ac1c50f9098..c3186f69a5ca07e6aaafc8cc38415d877ca0d9f4 100644 (file)
@@ -1834,6 +1834,14 @@ void Value::dump() const { print(errs()); errs() << '\n'; errs().flush(); }
 // Type::dump - allow easy printing of Types from the debugger.
 void Type::dump() const { print(errs()); errs() << '\n'; errs().flush(); }
 
+// Type::dump - allow easy printing of Types from the debugger.
+// This one uses type names from the given context module
+void Type::dump(const Module *Context) const {
+  WriteTypeSymbolic(errs(), this, Context);
+  errs() << '\n';
+  errs().flush();
+}
+
 // Module::dump() - Allow printing of Modules from the debugger.
 void Module::dump() const { print(errs(), 0); errs().flush(); }