diff options
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp b/llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp index 79e5b9d690d..c349e7ecce9 100644 --- a/llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp +++ b/llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp @@ -68,7 +68,10 @@ void ModuleDebugFileChecksumFragment::addChecksum(uint32_t StringTableOffset, // This maps the offset of this string in the string table to the offset // of this checksum entry in the checksum buffer. OffsetMap[StringTableOffset] = SerializedSize; - SerializedSize += sizeof(FileChecksumEntryHeader) + Bytes.size(); + assert(SerializedSize % 4 == 0); + + uint32_t Len = alignTo(sizeof(FileChecksumEntryHeader) + Bytes.size(), 4); + SerializedSize += Len; } uint32_t ModuleDebugFileChecksumFragment::calculateSerializedLength() { @@ -85,6 +88,8 @@ Error ModuleDebugFileChecksumFragment::commit(BinaryStreamWriter &Writer) { return EC; if (auto EC = Writer.writeArray(makeArrayRef(FC.Checksum))) return EC; + if (auto EC = Writer.padToAlignment(4)) + return EC; } return Error::success(); } |