[DebugInfo] Unify ChecksumKind and Checksum value in DIFile

Rather than encode the absence of a checksum with a Kind variant, instead put
both the kind and value in a struct and wrap it in an Optional.

Differential Revision: http://reviews.llvm.org/D43043



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324928 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Scott Linder
2018-02-12 19:45:54 +00:00
parent 4ac9cb02bc
commit 4863252bec
17 changed files with 199 additions and 123 deletions

View File

@@ -1551,8 +1551,15 @@ void ModuleBitcodeWriter::writeDIFile(const DIFile *N,
Record.push_back(N->isDistinct());
Record.push_back(VE.getMetadataOrNullID(N->getRawFilename()));
Record.push_back(VE.getMetadataOrNullID(N->getRawDirectory()));
Record.push_back(N->getChecksumKind());
Record.push_back(VE.getMetadataOrNullID(N->getRawChecksum()));
if (N->getRawChecksum()) {
Record.push_back(N->getRawChecksum()->Kind);
Record.push_back(VE.getMetadataOrNullID(N->getRawChecksum()->Value));
} else {
// Maintain backwards compatibility with the old internal representation of
// CSK_None in ChecksumKind by writing nulls here when Checksum is None.
Record.push_back(0);
Record.push_back(VE.getMetadataOrNullID(nullptr));
}
Stream.EmitRecord(bitc::METADATA_FILE, Record, Abbrev);
Record.clear();