diff options
author | Dan Gohman <gohman@apple.com> | 2010-09-09 20:53:58 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-09-09 20:53:58 +0000 |
commit | 3da076ffefafd09c01764d4094dd61cd7c79735a (patch) | |
tree | e3aad5233c84d34cb5b870f4dbb6c5a0e04dcf6c | |
parent | aa3ace10c1b90e07114e60700c8c1f8e6b4f3e84 (diff) | |
download | external_llvm-3da076ffefafd09c01764d4094dd61cd7c79735a.zip external_llvm-3da076ffefafd09c01764d4094dd61cd7c79735a.tar.gz external_llvm-3da076ffefafd09c01764d4094dd61cd7c79735a.tar.bz2 |
Print invalid metadata references as <badref>, for consistency with
regular value references.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113538 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 831a996..14b0161 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -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"; } |