BitcodeWriter: Further unify function metadata, NFC
Further unify the handling of function-local metadata with global metadata, by exposing the same interface in ValueEnumerator. Both contexts use the same accessors: - getMDStrings(): get the strings for this block. - getNonMDStrings(): get the non-strings for this block. A future commit will start adding strings to the function-block. llvm-svn: 265224
This commit is contained in:
@@ -1429,7 +1429,7 @@ static void writeMetadataRecords(ArrayRef<const Metadata *> MDs,
|
||||
static void writeModuleMetadata(const Module &M,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream) {
|
||||
if (VE.getMDs().empty() && M.named_metadata_empty())
|
||||
if (!VE.hasMDs() && M.named_metadata_empty())
|
||||
return;
|
||||
|
||||
Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
|
||||
@@ -1442,13 +1442,14 @@ static void writeModuleMetadata(const Module &M,
|
||||
|
||||
static void writeFunctionMetadata(const Function &F, const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream) {
|
||||
ArrayRef<const Metadata *> MDs = VE.getFunctionMDs();
|
||||
if (MDs.empty())
|
||||
if (!VE.hasMDs())
|
||||
return;
|
||||
|
||||
Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
|
||||
SmallVector<uint64_t, 64> Record;
|
||||
writeMetadataRecords(MDs, VE, Stream, Record);
|
||||
assert(VE.getMDStrings().empty() &&
|
||||
"Unexpected strings at the function-level");
|
||||
writeMetadataRecords(VE.getNonMDStrings(), VE, Stream, Record);
|
||||
Stream.ExitBlock();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user