Do not write empty METADATA_ATTACHMENT record.

llvm-svn: 84006
This commit is contained in:
Devang Patel 2009-10-13 18:51:28 +00:00
parent 271f1f07bc
commit 78cb102490
1 changed files with 7 additions and 5 deletions

View File

@ -580,6 +580,7 @@ static void WriteMetadataAttachment(const Function &F,
Record.push_back(VE.getValueID(ND));
}
}
if (!Record.empty()) {
if (!StartedMetadataBlock) {
Stream.EnterSubblock(bitc::METADATA_ATTACHMENT_ID, 3);
StartedMetadataBlock = true;
@ -587,6 +588,7 @@ static void WriteMetadataAttachment(const Function &F,
Stream.EmitRecord(bitc::METADATA_ATTACHMENT, Record, 0);
Record.clear();
}
}
if (StartedMetadataBlock)
Stream.ExitBlock();