diff options
author | Devang Patel <dpatel@apple.com> | 2009-10-13 18:51:28 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-10-13 18:51:28 +0000 |
commit | 5192e30a72b0f74f770cf4def00764f860c28045 (patch) | |
tree | 6bc41d9a92fa65db9c91a0568bd9f386ee3e0a9c /lib/Bitcode/Writer | |
parent | a917bfe8c233055fad10d38c8dd61f55ed084868 (diff) | |
download | external_llvm-5192e30a72b0f74f770cf4def00764f860c28045.zip external_llvm-5192e30a72b0f74f770cf4def00764f860c28045.tar.gz external_llvm-5192e30a72b0f74f770cf4def00764f860c28045.tar.bz2 |
Do not write empty METADATA_ATTACHMENT record.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer')
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index ae269df..2c45b34 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -580,12 +580,14 @@ static void WriteMetadataAttachment(const Function &F, Record.push_back(VE.getValueID(ND)); } } - if (!StartedMetadataBlock) { - Stream.EnterSubblock(bitc::METADATA_ATTACHMENT_ID, 3); - StartedMetadataBlock = true; + if (!Record.empty()) { + if (!StartedMetadataBlock) { + Stream.EnterSubblock(bitc::METADATA_ATTACHMENT_ID, 3); + StartedMetadataBlock = true; + } + Stream.EmitRecord(bitc::METADATA_ATTACHMENT, Record, 0); + Record.clear(); } - Stream.EmitRecord(bitc::METADATA_ATTACHMENT, Record, 0); - Record.clear(); } if (StartedMetadataBlock) |