From d288ef4c1788d3a951a7558c68312c2d320612b1 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 3 Jun 2017 15:20:36 +0000 Subject: Vendor import of llvm trunk r304659: https://llvm.org/svn/llvm-project/llvm/trunk@304659 --- lib/DebugInfo/CodeView/CodeViewRecordIO.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/DebugInfo/CodeView/CodeViewRecordIO.cpp') diff --git a/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp b/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp index 282e3103adc9..711144fc2faa 100644 --- a/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp +++ b/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp @@ -27,6 +27,14 @@ Error CodeViewRecordIO::beginRecord(Optional MaxLength) { Error CodeViewRecordIO::endRecord() { assert(!Limits.empty() && "Not in a record!"); Limits.pop_back(); + // We would like to assert that we actually read / wrote all the bytes that we + // expected to for this record, but unfortunately we can't do this. Some + // producers such as MASM over-allocate for certain types of records and + // commit the extraneous data, so when reading we can't be sure every byte + // will have been read. And when writing we over-allocate temporarily since + // we don't know how big the record is until we're finished writing it, so + // even though we don't commit the extraneous data, we still can't guarantee + // we're at the end of the allocated data. return Error::success(); } @@ -49,6 +57,12 @@ uint32_t CodeViewRecordIO::maxFieldLength() const { return *Min; } +Error CodeViewRecordIO::padToAlignment(uint32_t Align) { + if (isReading()) + return Reader->padToAlignment(Align); + return Writer->padToAlignment(Align); +} + Error CodeViewRecordIO::skipPadding() { assert(!isWriting() && "Cannot skip padding while writing!"); -- cgit v1.3