diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-24 21:06:21 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-24 21:06:21 +0000 |
| commit | d3e4c2a63f5af9c976126d74c31927a93478b887 (patch) | |
| tree | 5b03589d64126c38407eb9c739dc8bae79ce7c81 /llvm/lib | |
| parent | e30f10e6711b57e076b54d01049b63823dd9b441 (diff) | |
| download | bcm5719-llvm-d3e4c2a63f5af9c976126d74c31927a93478b887.tar.gz bcm5719-llvm-d3e4c2a63f5af9c976126d74c31927a93478b887.zip | |
AsmWriter: Parameterize the syntactic separator for attachments
Parameterize the separator for attachments, since `Function` metadata
attachments (PR23340) aren't going to use a `,` (comma). No real
functionality change.
llvm-svn: 235775
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/AsmWriter.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 54a370d08fb..299665531f3 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -1990,7 +1990,8 @@ private: /// \brief Print out metadata attachments. void printMetadataAttachments( - const SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs); + const SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs, + StringRef Separator); // printInfoComment - Print a little comment after the instruction indicating // which slot it occupies. @@ -2957,14 +2958,15 @@ void AssemblyWriter::printInstruction(const Instruction &I) { // Print Metadata info. SmallVector<std::pair<unsigned, MDNode *>, 4> InstMD; I.getAllMetadata(InstMD); - printMetadataAttachments(InstMD); + printMetadataAttachments(InstMD, ", "); // Print a nice comment. printInfoComment(I); } void AssemblyWriter::printMetadataAttachments( - const SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs) { + const SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs, + StringRef Separator) { if (MDs.empty()) return; @@ -2973,11 +2975,11 @@ void AssemblyWriter::printMetadataAttachments( for (const auto &I : MDs) { unsigned Kind = I.first; - if (Kind < MDNames.size()) { - Out << ", !" << MDNames[Kind]; - } else { - Out << ", !<unknown kind #" << Kind << ">"; - } + Out << Separator; + if (Kind < MDNames.size()) + Out << "!" << MDNames[Kind]; + else + Out << "!<unknown kind #" << Kind << ">"; Out << ' '; WriteAsOperandInternal(Out, I.second, &TypePrinter, &Machine, TheModule); } |

