diff options
author | Scott Linder <scott@scottlinder.com> | 2018-02-12 19:45:54 +0000 |
---|---|---|
committer | Scott Linder <scott@scottlinder.com> | 2018-02-12 19:45:54 +0000 |
commit | 7160384d40ac5025c5ab23cd898b5370749c66a1 (patch) | |
tree | a917fb3bd760c42467541559e913a5b09de8094c /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 4a4f35f32411abb73360247e53d59e1fea1ca7c8 (diff) | |
download | llvm-7160384d40ac5025c5ab23cd898b5370749c66a1.zip llvm-7160384d40ac5025c5ab23cd898b5370749c66a1.tar.gz llvm-7160384d40ac5025c5ab23cd898b5370749c66a1.tar.bz2 |
[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
llvm-svn: 324928
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 8c65e95..1062011 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -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(); |