aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2010-02-25 06:53:04 +0000
committerNick Lewycky <nicholas@mxc.ca>2010-02-25 06:53:04 +0000
commitfa0c54e3b88f103abb247e471917a6e6a5bb9a0f (patch)
treed6f2998d0a8ffc9a18c2b7370ecfc36176180aa0 /lib/VMCore/AsmWriter.cpp
parent58aa834d31c2c0f378c8de5ec0450c2ab5568a2a (diff)
downloadexternal_llvm-fa0c54e3b88f103abb247e471917a6e6a5bb9a0f.zip
external_llvm-fa0c54e3b88f103abb247e471917a6e6a5bb9a0f.tar.gz
external_llvm-fa0c54e3b88f103abb247e471917a6e6a5bb9a0f.tar.bz2
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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97124 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r--lib/VMCore/AsmWriter.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 1ed1384..361c58e 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -1988,12 +1988,16 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
}
// 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);
}