From 8b07f1bd5f639b217166ae386c1b572de93151e2 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Fri, 6 Feb 2015 22:27:22 +0000 Subject: [PATCH] AsmWriter: Extract writeMetadataAsOperand(), NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228446 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/AsmWriter.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp index 46f26c579ac..8b7ed55fe71 100644 --- a/lib/IR/AsmWriter.cpp +++ b/lib/IR/AsmWriter.cpp @@ -1286,6 +1286,17 @@ raw_ostream &operator<<(raw_ostream &OS, FieldSeparator &FS) { } } // end namespace +static void writeMetadataAsOperand(raw_ostream &Out, const Metadata *MD, + TypePrinting *TypePrinter, + SlotTracker *Machine, + const Module *Context) { + if (!MD) { + Out << "null"; + return; + } + WriteAsOperandInternal(Out, MD, TypePrinter, Machine, Context); +} + static void writeGenericDebugNode(raw_ostream &Out, const GenericDebugNode *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { @@ -1306,11 +1317,7 @@ static void writeGenericDebugNode(raw_ostream &Out, const GenericDebugNode *N, FieldSeparator IFS; for (auto &I : N->dwarf_operands()) { Out << IFS; - if (!I) { - Out << "null"; - continue; - } - WriteAsOperandInternal(Out, I, TypePrinter, Machine, Context); + writeMetadataAsOperand(Out, I, TypePrinter, Machine, Context); } Out << "}"; }