diff options
Diffstat (limited to 'llvm/lib/DebugInfo')
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp b/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp index dc72f500c87..eb79e8ac9a3 100644 --- a/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp +++ b/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp @@ -49,8 +49,10 @@ void ListRecordBuilder::finishSubRecord() { // back up and insert a continuation record, sliding the current subrecord // down. if (getLastContinuationSize() > 65535 - 8) { + assert(SubrecordStart != 0 && "can't slide from the start!"); SmallString<128> SubrecordCopy( Builder.str().slice(SubrecordStart, Builder.size())); + assert(SubrecordCopy.size() < 65530 && "subrecord is too large to slide!"); Builder.truncate(SubrecordStart); // Write a placeholder continuation record. diff --git a/llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp b/llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp index f1c293e39fd..112612cc85e 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeRecordBuilder.cpp @@ -91,15 +91,10 @@ void TypeRecordBuilder::writeEncodedUnsignedInteger(uint64_t Value) { } } -void TypeRecordBuilder::writeNullTerminatedString(const char *Value) { - assert(Value != nullptr); - - size_t Length = strlen(Value); - Stream.write(Value, Length); - writeUInt8(0); -} - void TypeRecordBuilder::writeNullTerminatedString(StringRef Value) { + // Microsoft's linker seems to have trouble with symbol names longer than + // 0xffd8 bytes. + Value = Value.substr(0, 0xffd8); Stream.write(Value.data(), Value.size()); writeUInt8(0); } |

