1//===- TypeRecordMapping.h --------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPERECORDMAPPING_H
10#define LLVM_DEBUGINFO_CODEVIEW_TYPERECORDMAPPING_H
11
12#include "llvm/DebugInfo/CodeView/CVRecord.h"
13#include "llvm/DebugInfo/CodeView/CodeView.h"
14#include "llvm/DebugInfo/CodeView/CodeViewRecordIO.h"
15#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
16#include "llvm/Support/Error.h"
17#include <optional>
18
19namespace llvm {
20class BinaryStreamReader;
21class BinaryStreamWriter;
22
23namespace codeview {
24class TypeIndex;
25struct CVMemberRecord;
26class TypeRecordMapping : public TypeVisitorCallbacks {
27public:
28 explicit TypeRecordMapping(BinaryStreamReader &Reader) : IO(Reader) {}
29 explicit TypeRecordMapping(BinaryStreamWriter &Writer) : IO(Writer) {}
30 explicit TypeRecordMapping(CodeViewRecordStreamer &Streamer) : IO(Streamer) {}
31
32 using TypeVisitorCallbacks::visitTypeBegin;
33 Error visitTypeBegin(CVType &Record) override;
34 Error visitTypeBegin(CVType &Record, TypeIndex Index) override;
35 Error visitTypeEnd(CVType &Record) override;
36
37 Error visitMemberBegin(CVMemberRecord &Record) override;
38 Error visitMemberEnd(CVMemberRecord &Record) override;
39
40#define TYPE_RECORD(EnumName, EnumVal, Name) \
41 Error visitKnownRecord(CVType &CVR, Name##Record &Record) override;
42#define MEMBER_RECORD(EnumName, EnumVal, Name) \
43 Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override;
44#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
45#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
46#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
47
48private:
49 std::optional<TypeLeafKind> TypeKind;
50 std::optional<TypeLeafKind> MemberKind;
51
52 CodeViewRecordIO IO;
53};
54}
55}
56
57#endif
58

source code of llvm/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h