llvm/lib/DebugInfo/CodeView/MethodListRecordBuilder.cpp
Reid Kleckner ef598a795b [codeview] Align class and print names of types
Summary: This way we can get rid of one of the fields in the .def file.

Reviewers: llvm-commits

Subscribers: zturner

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269461 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 19:37:07 +00:00

50 lines
1.6 KiB
C++

//===-- MethodListRecordBuilder.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/MethodListRecordBuilder.h"
#include "llvm/DebugInfo/CodeView/FieldListRecordBuilder.h"
using namespace llvm;
using namespace codeview;
MethodListRecordBuilder::MethodListRecordBuilder()
: ListRecordBuilder(TypeRecordKind::MethodOverloadList) {}
void MethodListRecordBuilder::writeMethod(MemberAccess Access, MethodKind Kind,
MethodOptions Options, TypeIndex Type,
int32_t VTableSlotOffset) {
TypeRecordBuilder &Builder = getBuilder();
uint16_t Flags = static_cast<uint16_t>(Access);
Flags |= static_cast<uint16_t>(Kind) << MethodKindShift;
Flags |= static_cast<uint16_t>(Options);
Builder.writeUInt16(Flags);
Builder.writeUInt16(0);
Builder.writeTypeIndex(Type);
switch (Kind) {
case MethodKind::IntroducingVirtual:
case MethodKind::PureIntroducingVirtual:
assert(VTableSlotOffset >= 0);
Builder.writeInt32(VTableSlotOffset);
break;
default:
assert(VTableSlotOffset == -1);
break;
}
// TODO: Fail if too big?
}
void MethodListRecordBuilder::writeMethod(const MethodInfo &Method) {
writeMethod(Method.getAccess(), Method.getKind(), Method.getOptions(),
Method.getType(), Method.getVTableSlotOffset());
}