blob: 61e63f96719aaa28ae8762174d8e84aed0f75677 [file] [log] [blame]
Zachary Turner3b147642016-10-08 01:12:01 +00001//===- YamlSymbolDumper.h ------------------------------------- *- C++ --*-===//
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#ifndef LLVM_TOOLS_LLVMPDBDUMP_YAMLSYMBOLDUMPER_H
11#define LLVM_TOOLS_LLVMPDBDUMP_YAMLSYMBOLDUMPER_H
12
13#include "llvm/DebugInfo/CodeView/CodeView.h"
14#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
15#include "llvm/Support/YAMLTraits.h"
16
17namespace llvm {
18namespace pdb {
19namespace yaml {
20struct SerializationContext;
21}
22}
23namespace codeview {
24namespace yaml {
25class YamlSymbolDumper : public SymbolVisitorCallbacks {
26public:
27 YamlSymbolDumper(llvm::yaml::IO &IO) : YamlIO(IO) {}
28
29 virtual Error visitSymbolBegin(CVSymbol &Record) override;
30
31#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
32 Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
33 visitKnownRecordImpl(#Name, CVR, Record); \
34 return Error::success(); \
35 }
36#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
37#include "llvm/DebugInfo/CodeView/CVSymbolTypes.def"
38
39private:
40 template <typename T>
41 void visitKnownRecordImpl(const char *Name, CVSymbol &Type, T &Record) {
42 YamlIO.mapRequired(Name, Record);
43 }
44
45 llvm::yaml::IO &YamlIO;
46};
47}
48}
49}
50
51namespace llvm {
52namespace yaml {
53template <> struct ScalarEnumerationTraits<codeview::SymbolKind> {
54 static void enumeration(IO &io, codeview::SymbolKind &Value);
55};
56
57#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
58 template <> struct MappingTraits<codeview::Name> { \
59 static void mapping(IO &IO, codeview::Name &Obj); \
60 };
61#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
62#include "llvm/DebugInfo/CodeView/CVSymbolTypes.def"
63}
64}
65
66#endif