BitcodeWriter: Reuse writeMetadataRecords, NFC

Change writeFunctionMetadata to call writeMetadataRecords.  For now
there's no functionality change, but makes it easy to serialize other
types of metadata in the function block in the future.

llvm-svn: 264557
This commit is contained in:
Duncan P. N. Exon Smith 2016-03-27 23:59:32 +00:00
parent cffd8cb9dc
commit b42fa2e5c6
1 changed files with 2 additions and 5 deletions

View File

@ -1416,7 +1416,7 @@ static void writeMetadataRecords(ArrayRef<const Metadata *> MDs,
#include "llvm/IR/Metadata.def"
}
}
writeValueAsMetadata(cast<ConstantAsMetadata>(MD), VE, Stream, Record);
writeValueAsMetadata(cast<ValueAsMetadata>(MD), VE, Stream, Record);
}
}
@ -1441,11 +1441,8 @@ static void writeFunctionMetadata(const Function &F, const ValueEnumerator &VE,
return;
Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
SmallVector<uint64_t, 64> Record;
for (const Metadata *MD : VE.getFunctionMDs())
writeValueAsMetadata(cast<LocalAsMetadata>(MD), VE, Stream, Record);
writeMetadataRecords(MDs, VE, Stream, Record);
Stream.ExitBlock();
}