1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Print invalid metadata references as <badref>, for consistency with

regular value references.

llvm-svn: 113538
This commit is contained in:
Dan Gohman 2010-09-09 20:53:58 +00:00
parent d5f271d31e
commit 2a0bee3d07

View File

@ -1165,7 +1165,11 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
else
Machine = new SlotTracker(Context);
}
Out << '!' << Machine->getMetadataSlot(N);
int Slot = Machine->getMetadataSlot(N);
if (Slot == -1)
Out << "<badref>";
else
Out << '!' << Slot;
return;
}
@ -1395,7 +1399,11 @@ void AssemblyWriter::printNamedMDNode(const NamedMDNode *NMD) {
Out << "!" << NMD->getName() << " = !{";
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
if (i) Out << ", ";
Out << '!' << Machine.getMetadataSlot(NMD->getOperand(i));
int Slot = Machine.getMetadataSlot(NMD->getOperand(i));
if (Slot == -1)
Out << "<badref>";
else
Out << '!' << Slot;
}
Out << "}\n";
}