1 //===-- MethodListRecordBuilder.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/MethodListRecordBuilder.h"
11 #include "llvm/DebugInfo/CodeView/FieldListRecordBuilder.h"
14 using namespace codeview;
16 MethodListRecordBuilder::MethodListRecordBuilder()
17 : ListRecordBuilder(TypeRecordKind::MethodList) {}
19 void MethodListRecordBuilder::writeMethod(MemberAccess Access, MethodKind Kind,
20 MethodOptions Options, TypeIndex Type,
21 int32_t VTableSlotOffset) {
22 TypeRecordBuilder &Builder = getBuilder();
24 uint16_t Flags = static_cast<uint16_t>(Access);
25 Flags |= static_cast<uint16_t>(Kind) << MethodKindShift;
26 Flags |= static_cast<uint16_t>(Options);
28 Builder.writeUInt16(Flags);
29 Builder.writeUInt16(0);
30 Builder.writeTypeIndex(Type);
32 case MethodKind::IntroducingVirtual:
33 case MethodKind::PureIntroducingVirtual:
34 assert(VTableSlotOffset >= 0);
35 Builder.writeInt32(VTableSlotOffset);
39 assert(VTableSlotOffset == -1);
43 // TODO: Fail if too big?
46 void MethodListRecordBuilder::writeMethod(const MethodInfo &Method) {
47 writeMethod(Method.getAccess(), Method.getKind(), Method.getOptions(),
48 Method.getType(), Method.getVTableSlotOffset());