aboutsummaryrefslogtreecommitdiff
path: root/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:50:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:50:12 +0000
commite6d1592492a3a379186bfb02bd0f4eda0669c0d5 (patch)
tree599ab169a01f1c86eda9adc774edaedde2f2db5b /lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
parent1a56a5ead7a2e84bee8240f5f6b033b5f1707154 (diff)
Diffstat (limited to 'lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp')
-rw-r--r--lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp b/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
index f180fc6990fc..799cffb7116e 100644
--- a/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
+++ b/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
@@ -66,14 +66,11 @@ void ContinuationRecordBuilder::begin(ContinuationRecordKind RecordKind) {
InjectedSegmentBytes =
ArrayRef<uint8_t>(FLIB, FLIB + sizeof(SegmentInjection));
- CVType Type;
- Type.Type = getTypeLeafKind(RecordKind);
+ // Seed the first record with an appropriate record prefix.
+ RecordPrefix Prefix(getTypeLeafKind(RecordKind));
+ CVType Type(&Prefix, sizeof(Prefix));
cantFail(Mapping.visitTypeBegin(Type));
- // Seed the first trecord with an appropriate record prefix.
- RecordPrefix Prefix;
- Prefix.RecordLen = 0;
- Prefix.RecordKind = Type.Type;
cantFail(SegmentWriter.writeObject(Prefix));
}
@@ -156,14 +153,9 @@ CVType ContinuationRecordBuilder::createSegmentRecord(
MutableArrayRef<uint8_t> Data = Buffer.data();
Data = Data.slice(OffBegin, OffEnd - OffBegin);
- CVType Type;
- Type.Type = getTypeLeafKind(*Kind);
- Type.RecordData = Data;
-
// Write the length to the RecordPrefix, making sure it does not include
// sizeof(RecordPrefix.Length)
RecordPrefix *Prefix = reinterpret_cast<RecordPrefix *>(Data.data());
- assert(Prefix->RecordKind == Type.Type);
Prefix->RecordLen = Data.size() - sizeof(RecordPrefix::RecordLen);
if (RefersTo.hasValue()) {
@@ -175,12 +167,12 @@ CVType ContinuationRecordBuilder::createSegmentRecord(
CR->IndexRef = RefersTo->getIndex();
}
- return Type;
+ return CVType(Data);
}
std::vector<CVType> ContinuationRecordBuilder::end(TypeIndex Index) {
- CVType Type;
- Type.Type = getTypeLeafKind(*Kind);
+ RecordPrefix Prefix(getTypeLeafKind(*Kind));
+ CVType Type(&Prefix, sizeof(Prefix));
cantFail(Mapping.visitTypeEnd(Type));
// We're now done, and we have a series of segments each beginning at an