[llvm-commits] [llvm] r74638 - /llvm/trunk/lib/VMCore/AsmWriter.cpp
Devang Patel
dpatel at apple.com
Wed Jul 1 13:59:22 PDT 2009
Author: dpatel
Date: Wed Jul 1 15:59:15 2009
New Revision: 74638
URL: http://llvm.org/viewvc/llvm-project?rev=74638&view=rev
Log:
Fix metadata unittests
Modified:
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=74638&r1=74637&r2=74638&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Jul 1 15:59:15 2009
@@ -1103,6 +1103,7 @@
void writeOperand(const Value *Op, bool PrintType);
void writeParamOperand(const Value *Operand, Attributes Attrs);
+ void printMDNode(const MDNode *Node, bool StandAlone);
const Module* getModule() { return TheModule; }
@@ -1110,7 +1111,6 @@
void printModule(const Module *M);
void printTypeSymbolTable(const TypeSymbolTable &ST);
void printGlobal(const GlobalVariable *GV);
- void printMDNode(const MDNode *Node, bool StandAlone);
void printAlias(const GlobalAlias *GV);
void printFunction(const Function *F);
void printArgument(const Argument *FA, Attributes Attrs);
@@ -1314,7 +1314,7 @@
// id number.
if (MI != MDNodes.end()) {
if (!StandAlone)
- Out << "metadata !" << MI->second;
+ Out << "!" << MI->second;
return;
}
@@ -1324,14 +1324,18 @@
Out << "!" << MetadataIDNo << " = ";
Out << "constant metadata ";
}
+
Out << "!{";
for (MDNode::const_elem_iterator I = Node->elem_begin(), E = Node->elem_end();
I != E;) {
const Value *TV = *I;
if (!TV)
Out << "null";
- else if (const MDNode *N = dyn_cast<MDNode>(TV))
+ else if (const MDNode *N = dyn_cast<MDNode>(TV)) {
+ TypePrinter.print(N->getType(), Out);
+ Out << ' ';
printMDNode(N, StandAlone);
+ }
else if (!*I)
Out << "null";
else
@@ -1901,6 +1905,14 @@
SlotTracker SlotTable(GV->getParent());
AssemblyWriter W(OS, SlotTable, GV->getParent(), AAW);
W.write(GV);
+ } else if (const MDNode *N = dyn_cast<MDNode>(this)) {
+ TypePrinting TypePrinter;
+ TypePrinter.print(N->getType(), OS);
+ OS << ' ';
+ // FIXME: Do we need a slot tracker for metadata ?
+ SlotTracker SlotTable((const Function *)NULL);
+ AssemblyWriter W(OS, SlotTable, NULL, AAW);
+ W.printMDNode(N, false);
} else if (const Constant *C = dyn_cast<Constant>(this)) {
TypePrinting TypePrinter;
TypePrinter.print(C->getType(), OS);
More information about the llvm-commits
mailing list