[llvm-commits] [llvm] r97124 - /llvm/trunk/lib/VMCore/AsmWriter.cpp

Nick Lewycky nicholas at mxc.ca
Wed Feb 24 22:53:04 PST 2010


Author: nicholas
Date: Thu Feb 25 00:53:04 2010
New Revision: 97124

URL: http://llvm.org/viewvc/llvm-project?rev=97124&view=rev
Log:
Dump the presence of attached metadata even if we don't know what it is. This
format is not parsable, even if the module is legal. To get parsable output,
dump the module instead of the function or smaller, since metadata kind are
attached to the module (not the context).

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=97124&r1=97123&r2=97124&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Thu Feb 25 00:53:04 2010
@@ -1988,12 +1988,16 @@
   }
 
   // Print Metadata info.
-  if (!MDNames.empty()) {
-    SmallVector<std::pair<unsigned, MDNode*>, 4> InstMD;
-    I.getAllMetadata(InstMD);
-    for (unsigned i = 0, e = InstMD.size(); i != e; ++i)
-      Out << ", !" << MDNames[InstMD[i].first]
-          << " !" << Machine.getMetadataSlot(InstMD[i].second);
+  SmallVector<std::pair<unsigned, MDNode*>, 4> InstMD;
+  I.getAllMetadata(InstMD);
+  for (unsigned i = 0, e = InstMD.size(); i != e; ++i) {
+    unsigned Kind = InstMD[i].first;
+    if (Kind < MDNames.size()) {
+      Out << ", !" << MDNames[Kind];
+    } else {
+      Out << ", !<unknown kind #" << Kind << ">";
+    }
+    Out << " !" << Machine.getMetadataSlot(InstMD[i].second);
   }
   printInfoComment(I);
 }





More information about the llvm-commits mailing list