From 61e6e829c69970a059700c66509b981b97385b03 Mon Sep 17 00:00:00 2001 From: Victor Hernandez Date: Thu, 14 Jan 2010 01:47:37 +0000 Subject: [PATCH] Fix printing of function-local metadata in AsmWriter llvm-svn: 93402 --- llvm/lib/VMCore/AsmWriter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 92dbd93d353c..eff2c772c2b3 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -2062,8 +2062,9 @@ void Value::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const { else W.printAlias(cast(GV)); } else if (const MDNode *N = dyn_cast(this)) { - SlotTracker SlotTable((Function*)0); - AssemblyWriter W(OS, SlotTable, 0, AAW); + Function *F = N->getFunction(); + SlotTracker SlotTable(F); + AssemblyWriter W(OS, SlotTable, getModuleFromVal(F), AAW); W.printMDNodeBody(N); } else if (const NamedMDNode *N = dyn_cast(this)) { SlotTracker SlotTable(N->getParent());