[CodeView] Move CodeView symbol yaml logic to ObjectYAML.

This continues the effort to get the CodeView YAML parsing logic
into ObjectYAML.  After this patch, the only missing piece will
be the CodeView debug symbol subsections.

llvm-svn: 304256
This commit is contained in:
Zachary Turner 2017-05-30 23:50:44 +00:00
parent 025e82bac1
commit 1e4d3693c4
12 changed files with 507 additions and 517 deletions

View File

@ -34,6 +34,17 @@ class SymbolDeserializer : public SymbolVisitorCallbacks {
};
public:
template <typename T> static Error deserializeAs(CVSymbol Symbol, T &Record) {
SymbolDeserializer S(nullptr);
if (auto EC = S.visitSymbolBegin(Symbol))
return EC;
if (auto EC = S.visitKnownRecord(Symbol, Record))
return EC;
if (auto EC = S.visitSymbolEnd(Symbol))
return EC;
return Error::success();
}
explicit SymbolDeserializer(SymbolVisitorDelegate *Delegate)
: Delegate(Delegate) {}

View File

@ -35,8 +35,6 @@ protected:
public:
SymbolRecordKind getKind() const { return Kind; }
private:
SymbolRecordKind Kind;
};

View File

@ -45,6 +45,17 @@ class SymbolSerializer : public SymbolVisitorCallbacks {
}
public:
template <typename SymType>
static CVSymbol writeOneSymbol(SymType &Sym, BumpPtrAllocator &Storage) {
CVSymbol Result;
Result.Type = static_cast<SymbolKind>(Sym.Kind);
SymbolSerializer Serializer(Storage);
consumeError(Serializer.visitSymbolBegin(Result));
consumeError(Serializer.visitKnownRecord(Result, Sym));
consumeError(Serializer.visitSymbolEnd(Result));
return Result;
}
explicit SymbolSerializer(BumpPtrAllocator &Storage);
virtual Error visitSymbolBegin(CVSymbol &Record) override;

View File

@ -16,6 +16,9 @@
#define LLVM_OBJECTYAML_CODEVIEWYAML_H
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolSerializer.h"
#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeSerializer.h"
@ -28,6 +31,7 @@ namespace CodeViewYAML {
namespace detail {
struct MemberRecordBase;
struct LeafRecordBase;
struct SymbolRecordBase;
}
struct SourceLineEntry {
@ -96,6 +100,12 @@ struct LeafRecord {
static Expected<LeafRecord> fromCodeViewRecord(codeview::CVType Type);
};
struct SymbolRecord {
std::shared_ptr<detail::SymbolRecordBase> Symbol;
codeview::CVSymbol toCodeViewSymbol(BumpPtrAllocator &Allocator) const;
static Expected<SymbolRecord> fromCodeViewSymbol(codeview::CVSymbol Symbol);
};
} // namespace CodeViewYAML
} // namespace llvm
@ -114,8 +124,10 @@ LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::InlineeSite)
LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::LeafRecord)
LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::MemberRecord)
LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::SymbolRecord)
LLVM_YAML_DECLARE_ENUM_TRAITS(codeview::TypeLeafKind)
LLVM_YAML_DECLARE_ENUM_TRAITS(codeview::SymbolKind)
LLVM_YAML_DECLARE_ENUM_TRAITS(codeview::PointerToMemberRepresentation)
LLVM_YAML_DECLARE_ENUM_TRAITS(codeview::VFTableSlotKind)
LLVM_YAML_DECLARE_ENUM_TRAITS(codeview::CallingConvention)
@ -137,5 +149,6 @@ LLVM_YAML_DECLARE_BITSET_TRAITS(codeview::MethodOptions)
LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::LeafRecord)
LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::MemberRecord)
LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::SymbolRecord)
#endif

View File

@ -17,6 +17,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/EnumTables.h"
using namespace llvm;
using namespace llvm::codeview;
@ -35,7 +36,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(OneMethodRecord)
LLVM_YAML_IS_SEQUENCE_VECTOR(StringRef)
LLVM_YAML_IS_SEQUENCE_VECTOR(uint32_t)
LLVM_YAML_IS_SEQUENCE_VECTOR(VFTableSlotKind)
LLVM_YAML_IS_SEQUENCE_VECTOR(TypeIndex)
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(TypeIndex)
LLVM_YAML_DECLARE_MAPPING_TRAITS(llvm::codeview::OneMethodRecord)
LLVM_YAML_DECLARE_MAPPING_TRAITS(llvm::codeview::MemberPointerInfo)
@ -103,6 +104,34 @@ template <typename T> struct MemberRecordImpl : public MemberRecordBase {
mutable T Record;
};
struct SymbolRecordBase {
codeview::SymbolKind Kind;
explicit SymbolRecordBase(codeview::SymbolKind K) : Kind(K) {}
virtual ~SymbolRecordBase() {}
virtual void map(yaml::IO &io) = 0;
virtual codeview::CVSymbol
toCodeViewSymbol(BumpPtrAllocator &Allocator) const = 0;
virtual Error fromCodeViewSymbol(codeview::CVSymbol Type) = 0;
};
template <typename T> struct SymbolRecordImpl : public SymbolRecordBase {
explicit SymbolRecordImpl(codeview::SymbolKind K)
: SymbolRecordBase(K), Symbol(static_cast<SymbolRecordKind>(K)) {}
void map(yaml::IO &io) override;
codeview::CVSymbol
toCodeViewSymbol(BumpPtrAllocator &Allocator) const override {
return SymbolSerializer::writeOneSymbol(Symbol, Allocator);
}
Error fromCodeViewSymbol(codeview::CVSymbol CVS) override {
return SymbolDeserializer::deserializeAs<T>(CVS, Symbol);
}
mutable T Symbol;
};
}
}
}
@ -335,6 +364,112 @@ void ScalarBitSetTraits<LineFlags>::bitset(IO &io, LineFlags &Flags) {
io.enumFallback<Hex16>(Flags);
}
void ScalarEnumerationTraits<SymbolKind>::enumeration(IO &io,
SymbolKind &Value) {
auto SymbolNames = getSymbolTypeNames();
for (const auto &E : SymbolNames)
io.enumCase(Value, E.Name.str().c_str(), E.Value);
}
template <> struct ScalarBitSetTraits<CompileSym2Flags> {
static void bitset(IO &io, CompileSym2Flags &Flags) {
auto FlagNames = getCompileSym2FlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<CompileSym2Flags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<CompileSym3Flags> {
static void bitset(IO &io, CompileSym3Flags &Flags) {
auto FlagNames = getCompileSym3FlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<CompileSym3Flags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<ExportFlags> {
static void bitset(IO &io, ExportFlags &Flags) {
auto FlagNames = getExportSymFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<ExportFlags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<LocalSymFlags> {
static void bitset(IO &io, LocalSymFlags &Flags) {
auto FlagNames = getLocalFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<LocalSymFlags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<ProcSymFlags> {
static void bitset(IO &io, ProcSymFlags &Flags) {
auto FlagNames = getProcSymFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<ProcSymFlags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<FrameProcedureOptions> {
static void bitset(IO &io, FrameProcedureOptions &Flags) {
auto FlagNames = getFrameProcSymFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<FrameProcedureOptions>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<CPUType> {
static void enumeration(IO &io, CPUType &Cpu) {
auto CpuNames = getCPUTypeNames();
for (const auto &E : CpuNames) {
io.enumCase(Cpu, E.Name.str().c_str(), static_cast<CPUType>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<RegisterId> {
static void enumeration(IO &io, RegisterId &Reg) {
auto RegNames = getRegisterNames();
for (const auto &E : RegNames) {
io.enumCase(Reg, E.Name.str().c_str(), static_cast<RegisterId>(E.Value));
}
io.enumFallback<Hex16>(Reg);
}
};
template <> struct ScalarEnumerationTraits<TrampolineType> {
static void enumeration(IO &io, TrampolineType &Tramp) {
auto TrampNames = getTrampolineNames();
for (const auto &E : TrampNames) {
io.enumCase(Tramp, E.Name.str().c_str(),
static_cast<TrampolineType>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<ThunkOrdinal> {
static void enumeration(IO &io, ThunkOrdinal &Ord) {
auto ThunkNames = getThunkOrdinalNames();
for (const auto &E : ThunkNames) {
io.enumCase(Ord, E.Name.str().c_str(),
static_cast<ThunkOrdinal>(E.Value));
}
}
};
void ScalarTraits<HexFormattedString>::output(const HexFormattedString &Value,
void *ctx, raw_ostream &Out) {
StringRef Bytes(reinterpret_cast<const char *>(Value.Bytes.data()),
@ -773,3 +908,332 @@ void MappingTraits<MemberRecord>::mapping(IO &IO, MemberRecord &Obj) {
default: { llvm_unreachable("Unknown member kind!"); }
}
}
namespace llvm {
namespace CodeViewYAML {
namespace detail {
template <> void SymbolRecordImpl<ScopeEndSym>::map(IO &IO) {}
template <> void SymbolRecordImpl<Thunk32Sym>::map(IO &IO) {
IO.mapRequired("Parent", Symbol.Parent);
IO.mapRequired("End", Symbol.End);
IO.mapRequired("Next", Symbol.Next);
IO.mapRequired("Off", Symbol.Offset);
IO.mapRequired("Seg", Symbol.Segment);
IO.mapRequired("Len", Symbol.Length);
IO.mapRequired("Ordinal", Symbol.Thunk);
}
template <> void SymbolRecordImpl<TrampolineSym>::map(IO &IO) {
IO.mapRequired("Type", Symbol.Type);
IO.mapRequired("Size", Symbol.Size);
IO.mapRequired("ThunkOff", Symbol.ThunkOffset);
IO.mapRequired("TargetOff", Symbol.TargetOffset);
IO.mapRequired("ThunkSection", Symbol.ThunkSection);
IO.mapRequired("TargetSection", Symbol.TargetSection);
}
template <> void SymbolRecordImpl<SectionSym>::map(IO &IO) {
IO.mapRequired("SectionNumber", Symbol.SectionNumber);
IO.mapRequired("Alignment", Symbol.Alignment);
IO.mapRequired("Rva", Symbol.Rva);
IO.mapRequired("Length", Symbol.Length);
IO.mapRequired("Characteristics", Symbol.Characteristics);
IO.mapRequired("Name", Symbol.Name);
}
template <> void SymbolRecordImpl<CoffGroupSym>::map(IO &IO) {
IO.mapRequired("Size", Symbol.Size);
IO.mapRequired("Characteristics", Symbol.Characteristics);
IO.mapRequired("Offset", Symbol.Offset);
IO.mapRequired("Segment", Symbol.Segment);
IO.mapRequired("Name", Symbol.Name);
}
template <> void SymbolRecordImpl<ExportSym>::map(IO &IO) {
IO.mapRequired("Ordinal", Symbol.Ordinal);
IO.mapRequired("Flags", Symbol.Flags);
IO.mapRequired("Name", Symbol.Name);
}
template <> void SymbolRecordImpl<ProcSym>::map(IO &IO) {
// TODO: Print the linkage name
IO.mapRequired("PtrParent", Symbol.Parent);
IO.mapRequired("PtrEnd", Symbol.End);
IO.mapRequired("PtrNext", Symbol.Next);
IO.mapRequired("CodeSize", Symbol.CodeSize);
IO.mapRequired("DbgStart", Symbol.DbgStart);
IO.mapRequired("DbgEnd", Symbol.DbgEnd);
IO.mapRequired("FunctionType", Symbol.FunctionType);
IO.mapRequired("Segment", Symbol.Segment);
IO.mapRequired("Flags", Symbol.Flags);
IO.mapRequired("DisplayName", Symbol.Name);
}
template <> void SymbolRecordImpl<RegisterSym>::map(IO &IO) {
IO.mapRequired("Type", Symbol.Index);
IO.mapRequired("Seg", Symbol.Register);
IO.mapRequired("Name", Symbol.Name);
}
template <> void SymbolRecordImpl<PublicSym32>::map(IO &IO) {
IO.mapRequired("Type", Symbol.Index);
IO.mapRequired("Seg", Symbol.Segment);
IO.mapRequired("Off", Symbol.Offset);
IO.mapRequired("Name", Symbol.Name);
}
template <> void SymbolRecordImpl<ProcRefSym>::map(IO &IO) {
IO.mapRequired("SumName", Symbol.SumName);
IO.mapRequired("SymOffset", Symbol.SymOffset);
IO.mapRequired("Mod", Symbol.Module);
IO.mapRequired("Name", Symbol.Name);
}
template <> void SymbolRecordImpl<EnvBlockSym>::map(IO &IO) {
IO.mapRequired("Entries", Symbol.Fields);
}
template <> void SymbolRecordImpl<InlineSiteSym>::map(IO &IO) {
IO.mapRequired("PtrParent", Symbol.Parent);
IO.mapRequired("PtrEnd", Symbol.End);
IO.mapRequired("Inlinee", Symbol.Inlinee);
// TODO: The binary annotations
}
template <> void SymbolRecordImpl<LocalSym>::map(IO &IO) {
IO.mapRequired("Type", Symbol.Type);
IO.mapRequired("Flags", Symbol.Flags);
IO.mapRequired("VarName", Symbol.Name);
}
template <> void SymbolRecordImpl<DefRangeSym>::map(IO &IO) {
// TODO: Print the subfields
}
template <> void SymbolRecordImpl<DefRangeSubfieldSym>::map(IO &IO) {
// TODO: Print the subfields
}
template <> void SymbolRecordImpl<DefRangeRegisterSym>::map(IO &IO) {
// TODO: Print the subfields
}
template <> void SymbolRecordImpl<DefRangeFramePointerRelSym>::map(IO &IO) {
// TODO: Print the subfields
}
template <> void SymbolRecordImpl<DefRangeSubfieldRegisterSym>::map(IO &IO) {
// TODO: Print the subfields
}
template <>
void SymbolRecordImpl<DefRangeFramePointerRelFullScopeSym>::map(IO &IO) {
// TODO: Print the subfields
}
template <> void SymbolRecordImpl<DefRangeRegisterRelSym>::map(IO &IO) {
// TODO: Print the subfields
}
template <> void SymbolRecordImpl<BlockSym>::map(IO &IO) {
// TODO: Print the linkage name
IO.mapRequired("PtrParent", Symbol.Parent);
IO.mapRequired("PtrEnd", Symbol.End);
IO.mapRequired("CodeSize", Symbol.CodeSize);
IO.mapRequired("Segment", Symbol.Segment);
IO.mapRequired("BlockName", Symbol.Name);
}
template <> void SymbolRecordImpl<LabelSym>::map(IO &IO) {
// TODO: Print the linkage name
IO.mapRequired("Segment", Symbol.Segment);
IO.mapRequired("Flags", Symbol.Flags);
IO.mapRequired("Flags", Symbol.Flags);
IO.mapRequired("DisplayName", Symbol.Name);
}
template <> void SymbolRecordImpl<ObjNameSym>::map(IO &IO) {
IO.mapRequired("Signature", Symbol.Signature);
IO.mapRequired("ObjectName", Symbol.Name);
}
template <> void SymbolRecordImpl<Compile2Sym>::map(IO &IO) {
IO.mapRequired("Flags", Symbol.Flags);
IO.mapRequired("Machine", Symbol.Machine);
IO.mapRequired("FrontendMajor", Symbol.VersionFrontendMajor);
IO.mapRequired("FrontendMinor", Symbol.VersionFrontendMinor);
IO.mapRequired("FrontendBuild", Symbol.VersionFrontendBuild);
IO.mapRequired("BackendMajor", Symbol.VersionBackendMajor);
IO.mapRequired("BackendMinor", Symbol.VersionBackendMinor);
IO.mapRequired("BackendBuild", Symbol.VersionBackendBuild);
IO.mapRequired("Version", Symbol.Version);
}
template <> void SymbolRecordImpl<Compile3Sym>::map(IO &IO) {
IO.mapRequired("Flags", Symbol.Flags);
IO.mapRequired("Machine", Symbol.Machine);
IO.mapRequired("FrontendMajor", Symbol.VersionFrontendMajor);
IO.mapRequired("FrontendMinor", Symbol.VersionFrontendMinor);
IO.mapRequired("FrontendBuild", Symbol.VersionFrontendBuild);
IO.mapRequired("FrontendQFE", Symbol.VersionFrontendQFE);
IO.mapRequired("BackendMajor", Symbol.VersionBackendMajor);
IO.mapRequired("BackendMinor", Symbol.VersionBackendMinor);
IO.mapRequired("BackendBuild", Symbol.VersionBackendBuild);
IO.mapRequired("BackendQFE", Symbol.VersionBackendQFE);
IO.mapRequired("Version", Symbol.Version);
}
template <> void SymbolRecordImpl<FrameProcSym>::map(IO &IO) {
IO.mapRequired("TotalFrameBytes", Symbol.TotalFrameBytes);
IO.mapRequired("PaddingFrameBytes", Symbol.PaddingFrameBytes);
IO.mapRequired("OffsetToPadding", Symbol.OffsetToPadding);
IO.mapRequired("BytesOfCalleeSavedRegisters",
Symbol.BytesOfCalleeSavedRegisters);
IO.mapRequired("OffsetOfExceptionHandler", Symbol.OffsetOfExceptionHandler);
IO.mapRequired("SectionIdOfExceptionHandler",
Symbol.SectionIdOfExceptionHandler);
IO.mapRequired("Flags", Symbol.Flags);
}
template <> void SymbolRecordImpl<CallSiteInfoSym>::map(IO &IO) {
// TODO: Map Linkage Name
IO.mapRequired("Segment", Symbol.Segment);
IO.mapRequired("Type", Symbol.Type);
}
template <> void SymbolRecordImpl<FileStaticSym>::map(IO &IO) {
IO.mapRequired("Index", Symbol.Index);
IO.mapRequired("ModFilenameOffset", Symbol.ModFilenameOffset);
IO.mapRequired("Flags", Symbol.Flags);
IO.mapRequired("Name", Symbol.Name);
}
template <> void SymbolRecordImpl<HeapAllocationSiteSym>::map(IO &IO) {
// TODO: Map Linkage Name
IO.mapRequired("Segment", Symbol.Segment);
IO.mapRequired("CallInstructionSize", Symbol.CallInstructionSize);
IO.mapRequired("Type", Symbol.Type);
}
template <> void SymbolRecordImpl<FrameCookieSym>::map(IO &IO) {
// TODO: Map Linkage Name
IO.mapRequired("Register", Symbol.Register);
IO.mapRequired("CookieKind", Symbol.CookieKind);
IO.mapRequired("Flags", Symbol.Flags);
}
template <> void SymbolRecordImpl<CallerSym>::map(IO &IO) {
IO.mapRequired("FuncID", Symbol.Indices);
}
template <> void SymbolRecordImpl<UDTSym>::map(IO &IO) {
IO.mapRequired("Type", Symbol.Type);
IO.mapRequired("UDTName", Symbol.Name);
}
template <> void SymbolRecordImpl<BuildInfoSym>::map(IO &IO) {
IO.mapRequired("BuildId", Symbol.BuildId);
}
template <> void SymbolRecordImpl<BPRelativeSym>::map(IO &IO) {
IO.mapRequired("Offset", Symbol.Offset);
IO.mapRequired("Type", Symbol.Type);
IO.mapRequired("VarName", Symbol.Name);
}
template <> void SymbolRecordImpl<RegRelativeSym>::map(IO &IO) {
IO.mapRequired("Offset", Symbol.Offset);
IO.mapRequired("Type", Symbol.Type);
IO.mapRequired("Register", Symbol.Register);
IO.mapRequired("VarName", Symbol.Name);
}
template <> void SymbolRecordImpl<ConstantSym>::map(IO &IO) {
IO.mapRequired("Type", Symbol.Type);
IO.mapRequired("Value", Symbol.Value);
IO.mapRequired("Name", Symbol.Name);
}
template <> void SymbolRecordImpl<DataSym>::map(IO &IO) {
// TODO: Map linkage name
IO.mapRequired("Type", Symbol.Type);
IO.mapRequired("DisplayName", Symbol.Name);
}
template <> void SymbolRecordImpl<ThreadLocalDataSym>::map(IO &IO) {
// TODO: Map linkage name
IO.mapRequired("Type", Symbol.Type);
IO.mapRequired("DisplayName", Symbol.Name);
}
}
}
}
CVSymbol CodeViewYAML::SymbolRecord::toCodeViewSymbol(
BumpPtrAllocator &Allocator) const {
return Symbol->toCodeViewSymbol(Allocator);
}
namespace llvm {
namespace yaml {
template <> struct MappingTraits<SymbolRecordBase> {
static void mapping(IO &io, SymbolRecordBase &Record) { Record.map(io); }
};
}
}
template <typename SymbolType>
static inline Expected<CodeViewYAML::SymbolRecord>
fromCodeViewSymbolImpl(CVSymbol Symbol) {
CodeViewYAML::SymbolRecord Result;
auto Impl = std::make_shared<SymbolRecordImpl<SymbolType>>(Symbol.kind());
if (auto EC = Impl->fromCodeViewSymbol(Symbol))
return std::move(EC);
Result.Symbol = Impl;
return Result;
}
Expected<CodeViewYAML::SymbolRecord>
CodeViewYAML::SymbolRecord::fromCodeViewSymbol(CVSymbol Symbol) {
#define SYMBOL_RECORD(EnumName, EnumVal, ClassName) \
case EnumName: \
return fromCodeViewSymbolImpl<ClassName>(Symbol);
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
SYMBOL_RECORD(EnumName, EnumVal, ClassName)
switch (Symbol.kind()) {
#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
default: { llvm_unreachable("Unknown symbol kind!"); }
}
return make_error<CodeViewError>(cv_error_code::corrupt_record);
}
template <typename ConcreteType>
static void mapSymbolRecordImpl(IO &IO, const char *Class, SymbolKind Kind,
CodeViewYAML::SymbolRecord &Obj) {
if (!IO.outputting())
Obj.Symbol = std::make_shared<SymbolRecordImpl<ConcreteType>>(Kind);
IO.mapRequired(Class, *Obj.Symbol);
}
void MappingTraits<CodeViewYAML::SymbolRecord>::mapping(
IO &IO, CodeViewYAML::SymbolRecord &Obj) {
SymbolKind Kind;
if (IO.outputting())
Kind = Obj.Symbol->Kind;
IO.mapRequired("Kind", Kind);
#define SYMBOL_RECORD(EnumName, EnumVal, ClassName) \
case EnumName: \
mapSymbolRecordImpl<ClassName>(IO, #ClassName, Kind, Obj); \
break;
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
SYMBOL_RECORD(EnumName, EnumVal, ClassName)
switch (Kind) {
#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
default: { llvm_unreachable("Unknown symbol kind!"); }
}
}

View File

@ -28,7 +28,6 @@ add_llvm_tool(llvm-pdbdump
PrettyVariableDumper.cpp
StreamUtil.cpp
YAMLOutputStyle.cpp
YamlSymbolDumper.cpp
)
if(LLVM_USE_SANITIZE_COVERAGE)

View File

@ -9,8 +9,6 @@
#include "PdbYaml.h"
#include "YamlSymbolDumper.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/DebugInfo/CodeView/CVSymbolVisitor.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
@ -34,7 +32,6 @@ LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint32_t)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::StringRef)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::NamedStreamMapping)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbDbiModuleInfo)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbSymbolRecord)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamBlockList)
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::pdb::PdbRaw_FeatureSig)
@ -214,29 +211,6 @@ void MappingTraits<NamedStreamMapping>::mapping(IO &IO,
IO.mapRequired("StreamNum", Obj.StreamNumber);
}
void MappingTraits<PdbSymbolRecord>::mapping(IO &IO, PdbSymbolRecord &Obj) {
BumpPtrAllocator *Alloc =
reinterpret_cast<BumpPtrAllocator *>(IO.getContext());
codeview::SymbolVisitorCallbackPipeline Pipeline;
codeview::SymbolSerializer Serializer(*Alloc);
codeview::SymbolDeserializer Deserializer(nullptr);
codeview::yaml::YamlSymbolDumper Dumper(IO);
if (IO.outputting()) {
// For PDB to Yaml, deserialize into a high level record type, then dump it.
Pipeline.addCallbackToPipeline(Deserializer);
Pipeline.addCallbackToPipeline(Dumper);
} else {
// For the other way around, dump it into a concrete structure, and then
// serialize it into the CVRecord.
Pipeline.addCallbackToPipeline(Dumper);
Pipeline.addCallbackToPipeline(Serializer);
}
codeview::CVSymbolVisitor Visitor(Pipeline);
consumeError(Visitor.visitSymbolRecord(Obj.Record));
}
void MappingTraits<PdbModiStream>::mapping(IO &IO, PdbModiStream &Obj) {
IO.mapOptional("Signature", Obj.Signature, 4U);
IO.mapRequired("Records", Obj.Symbols);

View File

@ -57,13 +57,9 @@ struct PdbInfoStream {
std::vector<NamedStreamMapping> NamedStreams;
};
struct PdbSymbolRecord {
codeview::CVSymbol Record;
};
struct PdbModiStream {
uint32_t Signature;
std::vector<PdbSymbolRecord> Symbols;
std::vector<CodeViewYAML::SymbolRecord> Symbols;
};
struct PdbDbiModuleInfo {
@ -118,7 +114,6 @@ LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbInfoStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbTpiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::NamedStreamMapping)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbSymbolRecord)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbModiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiModuleInfo)

View File

@ -357,8 +357,11 @@ Error YAMLOutputStyle::dumpDbiStream() {
DMI.Modi->Signature = ModS.signature();
bool HadError = false;
for (auto &Sym : ModS.symbols(&HadError)) {
pdb::yaml::PdbSymbolRecord Record{Sym};
DMI.Modi->Symbols.push_back(Record);
auto ES = CodeViewYAML::SymbolRecord::fromCodeViewSymbol(Sym);
if (!ES)
return ES.takeError();
DMI.Modi->Symbols.push_back(*ES);
}
}
}

View File

@ -1,412 +0,0 @@
//===- YamlSymbolDumper.cpp ----------------------------------- *- C++ --*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "YamlSymbolDumper.h"
#include "PdbYaml.h"
#include "llvm/DebugInfo/CodeView/CVSymbolVisitor.h"
#include "llvm/DebugInfo/CodeView/EnumTables.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h"
using namespace llvm;
using namespace llvm::codeview;
using namespace llvm::codeview::yaml;
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(TypeIndex)
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint64_t)
LLVM_YAML_IS_SEQUENCE_VECTOR(OneMethodRecord)
LLVM_YAML_IS_SEQUENCE_VECTOR(VFTableSlotKind)
LLVM_YAML_IS_SEQUENCE_VECTOR(StringRef)
LLVM_YAML_IS_SEQUENCE_VECTOR(CVType)
namespace llvm {
namespace yaml {
void ScalarEnumerationTraits<SymbolKind>::enumeration(IO &io,
SymbolKind &Value) {
auto SymbolNames = getSymbolTypeNames();
for (const auto &E : SymbolNames)
io.enumCase(Value, E.Name.str().c_str(), E.Value);
}
template <> struct ScalarBitSetTraits<CompileSym2Flags> {
static void bitset(IO &io, CompileSym2Flags &Flags) {
auto FlagNames = getCompileSym2FlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<CompileSym2Flags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<CompileSym3Flags> {
static void bitset(IO &io, CompileSym3Flags &Flags) {
auto FlagNames = getCompileSym3FlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<CompileSym3Flags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<ExportFlags> {
static void bitset(IO &io, ExportFlags &Flags) {
auto FlagNames = getExportSymFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<ExportFlags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<LocalSymFlags> {
static void bitset(IO &io, LocalSymFlags &Flags) {
auto FlagNames = getLocalFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<LocalSymFlags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<ProcSymFlags> {
static void bitset(IO &io, ProcSymFlags &Flags) {
auto FlagNames = getProcSymFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<ProcSymFlags>(E.Value));
}
}
};
template <> struct ScalarBitSetTraits<FrameProcedureOptions> {
static void bitset(IO &io, FrameProcedureOptions &Flags) {
auto FlagNames = getFrameProcSymFlagNames();
for (const auto &E : FlagNames) {
io.bitSetCase(Flags, E.Name.str().c_str(),
static_cast<FrameProcedureOptions>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<CPUType> {
static void enumeration(IO &io, CPUType &Cpu) {
auto CpuNames = getCPUTypeNames();
for (const auto &E : CpuNames) {
io.enumCase(Cpu, E.Name.str().c_str(), static_cast<CPUType>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<RegisterId> {
static void enumeration(IO &io, RegisterId &Reg) {
auto RegNames = getRegisterNames();
for (const auto &E : RegNames) {
io.enumCase(Reg, E.Name.str().c_str(), static_cast<RegisterId>(E.Value));
}
io.enumFallback<Hex16>(Reg);
}
};
template <> struct ScalarEnumerationTraits<TrampolineType> {
static void enumeration(IO &io, TrampolineType &Tramp) {
auto TrampNames = getTrampolineNames();
for (const auto &E : TrampNames) {
io.enumCase(Tramp, E.Name.str().c_str(),
static_cast<TrampolineType>(E.Value));
}
}
};
template <> struct ScalarEnumerationTraits<ThunkOrdinal> {
static void enumeration(IO &io, ThunkOrdinal &Ord) {
auto ThunkNames = getThunkOrdinalNames();
for (const auto &E : ThunkNames) {
io.enumCase(Ord, E.Name.str().c_str(),
static_cast<ThunkOrdinal>(E.Value));
}
}
};
void MappingTraits<ScopeEndSym>::mapping(IO &IO, ScopeEndSym &Obj) {}
void MappingTraits<Thunk32Sym>::mapping(IO &IO, Thunk32Sym &Thunk) {
IO.mapRequired("Parent", Thunk.Parent);
IO.mapRequired("End", Thunk.End);
IO.mapRequired("Next", Thunk.Next);
IO.mapRequired("Off", Thunk.Offset);
IO.mapRequired("Seg", Thunk.Segment);
IO.mapRequired("Len", Thunk.Length);
IO.mapRequired("Ordinal", Thunk.Thunk);
}
void MappingTraits<TrampolineSym>::mapping(IO &IO, TrampolineSym &Tramp) {
IO.mapRequired("Type", Tramp.Type);
IO.mapRequired("Size", Tramp.Size);
IO.mapRequired("ThunkOff", Tramp.ThunkOffset);
IO.mapRequired("TargetOff", Tramp.TargetOffset);
IO.mapRequired("ThunkSection", Tramp.ThunkSection);
IO.mapRequired("TargetSection", Tramp.TargetSection);
}
void MappingTraits<SectionSym>::mapping(IO &IO, SectionSym &Section) {
IO.mapRequired("SectionNumber", Section.SectionNumber);
IO.mapRequired("Alignment", Section.Alignment);
IO.mapRequired("Rva", Section.Rva);
IO.mapRequired("Length", Section.Length);
IO.mapRequired("Characteristics", Section.Characteristics);
IO.mapRequired("Name", Section.Name);
}
void MappingTraits<CoffGroupSym>::mapping(IO &IO, CoffGroupSym &CoffGroup) {
IO.mapRequired("Size", CoffGroup.Size);
IO.mapRequired("Characteristics", CoffGroup.Characteristics);
IO.mapRequired("Offset", CoffGroup.Offset);
IO.mapRequired("Segment", CoffGroup.Segment);
IO.mapRequired("Name", CoffGroup.Name);
}
void MappingTraits<ExportSym>::mapping(IO &IO, ExportSym &Export) {
IO.mapRequired("Ordinal", Export.Ordinal);
IO.mapRequired("Flags", Export.Flags);
IO.mapRequired("Name", Export.Name);
}
void MappingTraits<ProcSym>::mapping(IO &IO, ProcSym &Proc) {
// TODO: Print the linkage name
IO.mapRequired("PtrParent", Proc.Parent);
IO.mapRequired("PtrEnd", Proc.End);
IO.mapRequired("PtrNext", Proc.Next);
IO.mapRequired("CodeSize", Proc.CodeSize);
IO.mapRequired("DbgStart", Proc.DbgStart);
IO.mapRequired("DbgEnd", Proc.DbgEnd);
IO.mapRequired("FunctionType", Proc.FunctionType);
IO.mapRequired("Segment", Proc.Segment);
IO.mapRequired("Flags", Proc.Flags);
IO.mapRequired("DisplayName", Proc.Name);
}
void MappingTraits<RegisterSym>::mapping(IO &IO, RegisterSym &Register) {
IO.mapRequired("Type", Register.Index);
IO.mapRequired("Seg", Register.Register);
IO.mapRequired("Name", Register.Name);
}
void MappingTraits<PublicSym32>::mapping(IO &IO, PublicSym32 &Public) {
IO.mapRequired("Type", Public.Index);
IO.mapRequired("Seg", Public.Segment);
IO.mapRequired("Off", Public.Offset);
IO.mapRequired("Name", Public.Name);
}
void MappingTraits<ProcRefSym>::mapping(IO &IO, ProcRefSym &ProcRef) {
IO.mapRequired("SumName", ProcRef.SumName);
IO.mapRequired("SymOffset", ProcRef.SymOffset);
IO.mapRequired("Mod", ProcRef.Module);
IO.mapRequired("Name", ProcRef.Name);
}
void MappingTraits<EnvBlockSym>::mapping(IO &IO, EnvBlockSym &EnvBlock) {
IO.mapRequired("Entries", EnvBlock.Fields);
}
void MappingTraits<InlineSiteSym>::mapping(IO &IO, InlineSiteSym &InlineSite) {
IO.mapRequired("PtrParent", InlineSite.Parent);
IO.mapRequired("PtrEnd", InlineSite.End);
IO.mapRequired("Inlinee", InlineSite.Inlinee);
// TODO: The binary annotations
}
void MappingTraits<LocalSym>::mapping(IO &IO, LocalSym &Local) {
IO.mapRequired("Type", Local.Type);
IO.mapRequired("Flags", Local.Flags);
IO.mapRequired("VarName", Local.Name);
}
void MappingTraits<DefRangeSym>::mapping(IO &IO, DefRangeSym &Obj) {
// TODO: Print the subfields
}
void MappingTraits<DefRangeSubfieldSym>::mapping(IO &IO,
DefRangeSubfieldSym &Obj) {
// TODO: Print the subfields
}
void MappingTraits<DefRangeRegisterSym>::mapping(IO &IO,
DefRangeRegisterSym &Obj) {
// TODO: Print the subfields
}
void MappingTraits<DefRangeFramePointerRelSym>::mapping(
IO &IO, DefRangeFramePointerRelSym &Obj) {
// TODO: Print the subfields
}
void MappingTraits<DefRangeSubfieldRegisterSym>::mapping(
IO &IO, DefRangeSubfieldRegisterSym &Obj) {
// TODO: Print the subfields
}
void MappingTraits<DefRangeFramePointerRelFullScopeSym>::mapping(
IO &IO, DefRangeFramePointerRelFullScopeSym &Obj) {
// TODO: Print the subfields
}
void MappingTraits<DefRangeRegisterRelSym>::mapping(
IO &IO, DefRangeRegisterRelSym &Obj) {
// TODO: Print the subfields
}
void MappingTraits<BlockSym>::mapping(IO &IO, BlockSym &Block) {
// TODO: Print the linkage name
IO.mapRequired("PtrParent", Block.Parent);
IO.mapRequired("PtrEnd", Block.End);
IO.mapRequired("CodeSize", Block.CodeSize);
IO.mapRequired("Segment", Block.Segment);
IO.mapRequired("BlockName", Block.Name);
}
void MappingTraits<LabelSym>::mapping(IO &IO, LabelSym &Label) {
// TODO: Print the linkage name
IO.mapRequired("Segment", Label.Segment);
IO.mapRequired("Flags", Label.Flags);
IO.mapRequired("Flags", Label.Flags);
IO.mapRequired("DisplayName", Label.Name);
}
void MappingTraits<ObjNameSym>::mapping(IO &IO, ObjNameSym &ObjName) {
IO.mapRequired("Signature", ObjName.Signature);
IO.mapRequired("ObjectName", ObjName.Name);
}
void MappingTraits<Compile2Sym>::mapping(IO &IO, Compile2Sym &Compile2) {
IO.mapRequired("Flags", Compile2.Flags);
IO.mapRequired("Machine", Compile2.Machine);
IO.mapRequired("FrontendMajor", Compile2.VersionFrontendMajor);
IO.mapRequired("FrontendMinor", Compile2.VersionFrontendMinor);
IO.mapRequired("FrontendBuild", Compile2.VersionFrontendBuild);
IO.mapRequired("BackendMajor", Compile2.VersionBackendMajor);
IO.mapRequired("BackendMinor", Compile2.VersionBackendMinor);
IO.mapRequired("BackendBuild", Compile2.VersionBackendBuild);
IO.mapRequired("Version", Compile2.Version);
}
void MappingTraits<Compile3Sym>::mapping(IO &IO, Compile3Sym &Compile3) {
IO.mapRequired("Flags", Compile3.Flags);
IO.mapRequired("Machine", Compile3.Machine);
IO.mapRequired("FrontendMajor", Compile3.VersionFrontendMajor);
IO.mapRequired("FrontendMinor", Compile3.VersionFrontendMinor);
IO.mapRequired("FrontendBuild", Compile3.VersionFrontendBuild);
IO.mapRequired("FrontendQFE", Compile3.VersionFrontendQFE);
IO.mapRequired("BackendMajor", Compile3.VersionBackendMajor);
IO.mapRequired("BackendMinor", Compile3.VersionBackendMinor);
IO.mapRequired("BackendBuild", Compile3.VersionBackendBuild);
IO.mapRequired("BackendQFE", Compile3.VersionBackendQFE);
IO.mapRequired("Version", Compile3.Version);
}
void MappingTraits<FrameProcSym>::mapping(IO &IO, FrameProcSym &FrameProc) {
IO.mapRequired("TotalFrameBytes", FrameProc.TotalFrameBytes);
IO.mapRequired("PaddingFrameBytes", FrameProc.PaddingFrameBytes);
IO.mapRequired("OffsetToPadding", FrameProc.OffsetToPadding);
IO.mapRequired("BytesOfCalleeSavedRegisters",
FrameProc.BytesOfCalleeSavedRegisters);
IO.mapRequired("OffsetOfExceptionHandler",
FrameProc.OffsetOfExceptionHandler);
IO.mapRequired("SectionIdOfExceptionHandler",
FrameProc.SectionIdOfExceptionHandler);
IO.mapRequired("Flags", FrameProc.Flags);
}
void MappingTraits<CallSiteInfoSym>::mapping(IO &IO,
CallSiteInfoSym &CallSiteInfo) {
// TODO: Map Linkage Name
IO.mapRequired("Segment", CallSiteInfo.Segment);
IO.mapRequired("Type", CallSiteInfo.Type);
}
void MappingTraits<FileStaticSym>::mapping(IO &IO, FileStaticSym &FileStatic) {
IO.mapRequired("Index", FileStatic.Index);
IO.mapRequired("ModFilenameOffset", FileStatic.ModFilenameOffset);
IO.mapRequired("Flags", FileStatic.Flags);
IO.mapRequired("Name", FileStatic.Name);
}
void MappingTraits<HeapAllocationSiteSym>::mapping(
IO &IO, HeapAllocationSiteSym &HeapAllocSite) {
// TODO: Map Linkage Name
IO.mapRequired("Segment", HeapAllocSite.Segment);
IO.mapRequired("CallInstructionSize", HeapAllocSite.CallInstructionSize);
IO.mapRequired("Type", HeapAllocSite.Type);
}
void MappingTraits<FrameCookieSym>::mapping(IO &IO,
FrameCookieSym &FrameCookie) {
// TODO: Map Linkage Name
IO.mapRequired("Register", FrameCookie.Register);
IO.mapRequired("CookieKind", FrameCookie.CookieKind);
IO.mapRequired("Flags", FrameCookie.Flags);
}
void MappingTraits<CallerSym>::mapping(IO &IO, CallerSym &Caller) {
// TODO: Correctly handle the ArrayRef in here.
std::vector<TypeIndex> Indices(Caller.Indices);
IO.mapRequired("FuncID", Indices);
}
void MappingTraits<UDTSym>::mapping(IO &IO, UDTSym &UDT) {
IO.mapRequired("Type", UDT.Type);
IO.mapRequired("UDTName", UDT.Name);
}
void MappingTraits<BuildInfoSym>::mapping(IO &IO, BuildInfoSym &BuildInfo) {
IO.mapRequired("BuildId", BuildInfo.BuildId);
}
void MappingTraits<BPRelativeSym>::mapping(IO &IO, BPRelativeSym &BPRel) {
IO.mapRequired("Offset", BPRel.Offset);
IO.mapRequired("Type", BPRel.Type);
IO.mapRequired("VarName", BPRel.Name);
}
void MappingTraits<RegRelativeSym>::mapping(IO &IO, RegRelativeSym &RegRel) {
IO.mapRequired("Offset", RegRel.Offset);
IO.mapRequired("Type", RegRel.Type);
IO.mapRequired("Register", RegRel.Register);
IO.mapRequired("VarName", RegRel.Name);
}
void MappingTraits<ConstantSym>::mapping(IO &IO, ConstantSym &Constant) {
IO.mapRequired("Type", Constant.Type);
IO.mapRequired("Value", Constant.Value);
IO.mapRequired("Name", Constant.Name);
}
void MappingTraits<DataSym>::mapping(IO &IO, DataSym &Data) {
// TODO: Map linkage name
IO.mapRequired("Type", Data.Type);
IO.mapRequired("DisplayName", Data.Name);
}
void MappingTraits<ThreadLocalDataSym>::mapping(IO &IO,
ThreadLocalDataSym &Data) {
// TODO: Map linkage name
IO.mapRequired("Type", Data.Type);
IO.mapRequired("DisplayName", Data.Name);
}
}
}
Error llvm::codeview::yaml::YamlSymbolDumper::visitSymbolBegin(CVSymbol &CVR) {
YamlIO.mapRequired("Kind", CVR.Type);
return Error::success();
}

View File

@ -1,66 +0,0 @@
//===- 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/CodeViewSymbols.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/CodeViewSymbols.def"
}
}
#endif

View File

@ -537,7 +537,7 @@ static void yamlToPdb(StringRef Path) {
if (MI.Modi.hasValue()) {
const auto &ModiStream = *MI.Modi;
for (auto Symbol : ModiStream.Symbols)
ModiBuilder.addSymbol(Symbol.Record);
ModiBuilder.addSymbol(Symbol.toCodeViewSymbol(Allocator));
}
if (MI.FileLineInfo.hasValue()) {
const auto &FLI = *MI.FileLineInfo;