mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
6931521bfe
This is the first step towards round-tripping symbol information, and thusly being able to write symbol information to a PDB. This patch writes the symbol information for each compiland to the Yaml when running in pdb2yaml mode. There's still some loose ends, such as what to do about relocations (necessary in order to print linkage names), how to print enums with friendly names, and how to give the dumper access to the StringTable, but this is a good first start. llvm-svn: 283641
67 lines
2.0 KiB
C++
67 lines
2.0 KiB
C++
//===- YamlSymbolDumper.h ------------------------------------- *- C++ --*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TOOLS_LLVMPDBDUMP_YAMLSYMBOLDUMPER_H
|
|
#define LLVM_TOOLS_LLVMPDBDUMP_YAMLSYMBOLDUMPER_H
|
|
|
|
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
|
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
|
|
#include "llvm/Support/YAMLTraits.h"
|
|
|
|
namespace llvm {
|
|
namespace pdb {
|
|
namespace yaml {
|
|
struct SerializationContext;
|
|
}
|
|
}
|
|
namespace codeview {
|
|
namespace yaml {
|
|
class YamlSymbolDumper : public SymbolVisitorCallbacks {
|
|
public:
|
|
YamlSymbolDumper(llvm::yaml::IO &IO) : YamlIO(IO) {}
|
|
|
|
virtual Error visitSymbolBegin(CVSymbol &Record) override;
|
|
|
|
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
|
|
Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
|
|
visitKnownRecordImpl(#Name, CVR, Record); \
|
|
return Error::success(); \
|
|
}
|
|
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
|
|
#include "llvm/DebugInfo/CodeView/CVSymbolTypes.def"
|
|
|
|
private:
|
|
template <typename T>
|
|
void visitKnownRecordImpl(const char *Name, CVSymbol &Type, T &Record) {
|
|
YamlIO.mapRequired(Name, Record);
|
|
}
|
|
|
|
llvm::yaml::IO &YamlIO;
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
namespace llvm {
|
|
namespace yaml {
|
|
template <> struct ScalarEnumerationTraits<codeview::SymbolKind> {
|
|
static void enumeration(IO &io, codeview::SymbolKind &Value);
|
|
};
|
|
|
|
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
|
|
template <> struct MappingTraits<codeview::Name> { \
|
|
static void mapping(IO &IO, codeview::Name &Obj); \
|
|
};
|
|
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
|
|
#include "llvm/DebugInfo/CodeView/CVSymbolTypes.def"
|
|
}
|
|
}
|
|
|
|
#endif
|