Add support for printing constpointerrefs more nicely

llvm-svn: 3654
This commit is contained in:
Chris Lattner 2002-09-10 15:53:49 +00:00
parent 3c787446c7
commit 7d734801d1
1 changed files with 7 additions and 0 deletions

View File

@ -872,6 +872,13 @@ void Instruction::print(std::ostream &o) const {
void Constant::print(std::ostream &o) const { void Constant::print(std::ostream &o) const {
if (this == 0) { o << "<null> constant value\n"; return; } 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() << " "; o << " " << getType()->getDescription() << " ";
map<const Type *, string> TypeTable; map<const Type *, string> TypeTable;