diff options
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp')
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp index c272985cf2d4..1af59ff679dd 100644 --- a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp +++ b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp @@ -188,14 +188,17 @@ Error CodeViewRecordIO::mapEncodedInteger(uint64_t &Value, Error CodeViewRecordIO::mapEncodedInteger(APSInt &Value, const Twine &Comment) { if (isStreaming()) { + // FIXME: We also need to handle big values here, but it's + // not clear how we can excercise this code path yet. if (Value.isSigned()) emitEncodedSignedInteger(Value.getSExtValue(), Comment); else emitEncodedUnsignedInteger(Value.getZExtValue(), Comment); } else if (isWriting()) { if (Value.isSigned()) - return writeEncodedSignedInteger(Value.getSExtValue()); - return writeEncodedUnsignedInteger(Value.getZExtValue()); + return writeEncodedSignedInteger( + Value.isSingleWord() ? Value.getSExtValue() : INT64_MIN); + return writeEncodedUnsignedInteger(Value.getLimitedValue()); } else return consume(*Reader, Value); return Error::success(); @@ -273,6 +276,9 @@ Error CodeViewRecordIO::mapStringZVectorZ(std::vector<StringRef> &Value, void CodeViewRecordIO::emitEncodedSignedInteger(const int64_t &Value, const Twine &Comment) { + // FIXME: There are no test cases covering this function. + // This may be because we always consider enumerators to be unsigned. + // See FIXME at CodeViewDebug.cpp : CodeViewDebug::lowerTypeEnum. if (Value >= std::numeric_limits<int8_t>::min()) { Streamer->emitIntValue(LF_CHAR, 2); emitComment(Comment); @@ -291,8 +297,8 @@ void CodeViewRecordIO::emitEncodedSignedInteger(const int64_t &Value, } else { Streamer->emitIntValue(LF_QUADWORD, 2); emitComment(Comment); - Streamer->emitIntValue(Value, 4); - incrStreamedLen(6); + Streamer->emitIntValue(Value, 4); // FIXME: Why not 8 (size of quadword)? + incrStreamedLen(6); // FIXME: Why not 10 (8 + 2)? } } @@ -313,10 +319,11 @@ void CodeViewRecordIO::emitEncodedUnsignedInteger(const uint64_t &Value, Streamer->emitIntValue(Value, 4); incrStreamedLen(6); } else { + // FIXME: There are no test cases covering this block. Streamer->emitIntValue(LF_UQUADWORD, 2); emitComment(Comment); Streamer->emitIntValue(Value, 8); - incrStreamedLen(6); + incrStreamedLen(6); // FIXME: Why not 10 (8 + 2)? } } |
