llvm/lib/DebugInfo/CodeView/ListRecordBuilder.cpp
Reid Kleckner 3dbd3c0fd6 [codeview] Add basic record type translation
This only translates data members for now. Translating overloaded
methods is complicated, so I stopped short of doing that.

Reviewers: aaboud

Differential Revision: http://reviews.llvm.org/D20924

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271680 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 15:58:20 +00:00

34 lines
1.1 KiB
C++

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