mirror of
https://github.com/intel/llvm.git
synced 2026-01-29 04:16:38 +08:00
Print invalid metadata references as <badref>, for consistency with
regular value references. llvm-svn: 113538
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user