]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp
Merge ^/head r294777 through r294960.
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / DebugInfo / CodeView / ListRecordBuilder.cpp
1 //===-- ListRecordBuilder.cpp ---------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "llvm/DebugInfo/CodeView/ListRecordBuilder.h"
11
12 using namespace llvm;
13 using namespace codeview;
14
15 ListRecordBuilder::ListRecordBuilder(TypeRecordKind Kind) : Builder(Kind) {}
16
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;
21   if (Remainder != 0) {
22     for (int32_t PaddingBytesLeft = 4 - Remainder; PaddingBytesLeft > 0;
23          --PaddingBytesLeft) {
24       Builder.writeUInt8(0xf0 + PaddingBytesLeft);
25     }
26   }
27
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);
31 }