1292915Sdim//===-- ListRecordBuilder.cpp ---------------------------------------------===// 2292915Sdim// 3292915Sdim// The LLVM Compiler Infrastructure 4292915Sdim// 5292915Sdim// This file is distributed under the University of Illinois Open Source 6292915Sdim// License. See LICENSE.TXT for details. 7292915Sdim// 8292915Sdim//===----------------------------------------------------------------------===// 9292915Sdim 10292915Sdim#include "llvm/DebugInfo/CodeView/ListRecordBuilder.h" 11292915Sdim 12292915Sdimusing namespace llvm; 13292915Sdimusing namespace codeview; 14292915Sdim 15292915SdimListRecordBuilder::ListRecordBuilder(TypeRecordKind Kind) : Builder(Kind) {} 16292915Sdim 17292915Sdimvoid ListRecordBuilder::finishSubRecord() { 18292915Sdim // The builder starts at offset 2 in the actual CodeView buffer, so add an 19292915Sdim // additional offset of 2 before computing the alignment. 20292915Sdim uint32_t Remainder = (Builder.size() + 2) % 4; 21292915Sdim if (Remainder != 0) { 22292915Sdim for (int32_t PaddingBytesLeft = 4 - Remainder; PaddingBytesLeft > 0; 23292915Sdim --PaddingBytesLeft) { 24292915Sdim Builder.writeUInt8(0xf0 + PaddingBytesLeft); 25292915Sdim } 26292915Sdim } 27292915Sdim 28292915Sdim // TODO: Split the list into multiple records if it's longer than 64KB, using 29292915Sdim // a subrecord of TypeRecordKind::Index to chain the records together. 30292915Sdim assert(Builder.size() < 65536); 31292915Sdim} 32