aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-10 15:53:49 +0000
committerChris Lattner <sabre@nondot.org>2002-09-10 15:53:49 +0000
commit3bc06b33dac11e9372b06484139b4d4c11788273 (patch)
tree7fbc770fcd40f3acdee5b770cb8e42d2c2b3fc5e /lib
parent2aa831120c97fa4725aea97b0b3e67e8d95b4f38 (diff)
Add support for printing constpointerrefs more nicely
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3654 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/AsmWriter.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index d8a1394497..4ba1662143 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -872,6 +872,13 @@ void Instruction::print(std::ostream &o) const {
void Constant::print(std::ostream &o) const {
if (this == 0) { o << "<null> constant value\n"; return; }
+
+ // Handle CPR's special, because they have context information...
+ if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(this)) {
+ CPR->getValue()->print(o); // Print as a global value, with context info.
+ return;
+ }
+
o << " " << getType()->getDescription() << " ";
map<const Type *, string> TypeTable;