1 //===-- ListRecordBuilder.cpp ---------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/DebugInfo/CodeView/ListRecordBuilder.h"
13 using namespace codeview;
15 ListRecordBuilder::ListRecordBuilder(TypeRecordKind Kind) : Builder(Kind) {}
17 void ListRecordBuilder::finishSubRecord() {
18 // The builder starts at offset 2 in the actual CodeView buffer, so add an
19 // additional offset of 2 before computing the alignment.
20 uint32_t Remainder = (Builder.size() + 2) % 4;
22 for (int32_t PaddingBytesLeft = 4 - Remainder; PaddingBytesLeft > 0;
24 Builder.writeUInt8(0xf0 + PaddingBytesLeft);
28 // TODO: Split the list into multiple records if it's longer than 64KB, using
29 // a subrecord of TypeRecordKind::Index to chain the records together.
30 assert(Builder.size() < 65536);