llvm/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp

//===- CodeViewYAMLSymbols.cpp - CodeView YAMLIO Symbol implementation ----===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines classes for handling the YAML representation of CodeView
// Debug Info.
//
//===----------------------------------------------------------------------===//

#include "llvm/ObjectYAML/CodeViewYAMLSymbols.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
#include "llvm/DebugInfo/CodeView/EnumTables.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolSerializer.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/ObjectYAML/YAML.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/YAMLTraits.h"
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <optional>
#include <string>
#include <vector>

usingnamespacellvm;
usingnamespacellvm::codeview;
usingnamespacellvm::CodeViewYAML;
usingnamespacellvm::CodeViewYAML::detail;
usingnamespacellvm::yaml;

LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(TypeIndex)
LLVM_YAML_IS_SEQUENCE_VECTOR(LocalVariableAddrGap)

// We only need to declare these, the definitions are in CodeViewYAMLTypes.cpp
LLVM_YAML_DECLARE_SCALAR_TRAITS()
LLVM_YAML_DECLARE_SCALAR_TRAITS()

LLVM_YAML_DECLARE_ENUM_TRAITS(SymbolKind)
LLVM_YAML_DECLARE_ENUM_TRAITS(FrameCookieKind)

LLVM_YAML_DECLARE_BITSET_TRAITS(CompileSym2Flags)
LLVM_YAML_DECLARE_BITSET_TRAITS(CompileSym3Flags)
LLVM_YAML_DECLARE_BITSET_TRAITS(ExportFlags)
LLVM_YAML_DECLARE_BITSET_TRAITS(PublicSymFlags)
LLVM_YAML_DECLARE_BITSET_TRAITS(LocalSymFlags)
LLVM_YAML_DECLARE_BITSET_TRAITS(ProcSymFlags)
LLVM_YAML_DECLARE_BITSET_TRAITS(FrameProcedureOptions)
LLVM_YAML_DECLARE_ENUM_TRAITS(CPUType)
LLVM_YAML_DECLARE_ENUM_TRAITS(RegisterId)
LLVM_YAML_DECLARE_ENUM_TRAITS(TrampolineType)
LLVM_YAML_DECLARE_ENUM_TRAITS(ThunkOrdinal)
LLVM_YAML_DECLARE_ENUM_TRAITS(JumpTableEntrySize)

LLVM_YAML_STRONG_TYPEDEF()

LLVM_YAML_DECLARE_SCALAR_TRAITS()

StringRef ScalarTraits<TypeName>::input(StringRef S, void *V, TypeName &T) {}

void ScalarTraits<TypeName>::output(const TypeName &T, void *V,
                                    raw_ostream &R) {}

void ScalarEnumerationTraits<SymbolKind>::enumeration(IO &io,
                                                      SymbolKind &Value) {}

void ScalarBitSetTraits<CompileSym2Flags>::bitset(IO &io,
                                                  CompileSym2Flags &Flags) {}

void ScalarBitSetTraits<CompileSym3Flags>::bitset(IO &io,
                                                  CompileSym3Flags &Flags) {}

void ScalarBitSetTraits<ExportFlags>::bitset(IO &io, ExportFlags &Flags) {}

void ScalarBitSetTraits<PublicSymFlags>::bitset(IO &io, PublicSymFlags &Flags) {}

void ScalarBitSetTraits<LocalSymFlags>::bitset(IO &io, LocalSymFlags &Flags) {}

void ScalarBitSetTraits<ProcSymFlags>::bitset(IO &io, ProcSymFlags &Flags) {}

void ScalarBitSetTraits<FrameProcedureOptions>::bitset(
    IO &io, FrameProcedureOptions &Flags) {}

void ScalarEnumerationTraits<CPUType>::enumeration(IO &io, CPUType &Cpu) {}

void ScalarEnumerationTraits<RegisterId>::enumeration(IO &io, RegisterId &Reg) {}

void ScalarEnumerationTraits<TrampolineType>::enumeration(
    IO &io, TrampolineType &Tramp) {}

void ScalarEnumerationTraits<ThunkOrdinal>::enumeration(IO &io,
                                                        ThunkOrdinal &Ord) {}

void ScalarEnumerationTraits<FrameCookieKind>::enumeration(
    IO &io, FrameCookieKind &FC) {}

void ScalarEnumerationTraits<JumpTableEntrySize>::enumeration(
    IO &io, JumpTableEntrySize &FC) {}

namespace llvm {
namespace yaml {
template <> struct MappingTraits<LocalVariableAddrRange> {};
template <> struct MappingTraits<LocalVariableAddrGap> {};
} // namespace yaml
} // namespace llvm

namespace llvm {
namespace CodeViewYAML {
namespace detail {

struct SymbolRecordBase {};

template <typename T> struct SymbolRecordImpl : public SymbolRecordBase {};

struct UnknownSymbolRecord : public SymbolRecordBase {};

template <> void SymbolRecordImpl<ScopeEndSym>::map(IO &IO) {}

void UnknownSymbolRecord::map(yaml::IO &io) {}

template <> void SymbolRecordImpl<Thunk32Sym>::map(IO &IO) {}

template <> void SymbolRecordImpl<TrampolineSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<SectionSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<CoffGroupSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<ExportSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<ProcSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<RegisterSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<PublicSym32>::map(IO &IO) {}

template <> void SymbolRecordImpl<ProcRefSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<EnvBlockSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<InlineSiteSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<LocalSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<DefRangeSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<DefRangeSubfieldSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<DefRangeRegisterSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<DefRangeFramePointerRelSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<DefRangeSubfieldRegisterSym>::map(IO &IO) {}

template <>
void SymbolRecordImpl<DefRangeFramePointerRelFullScopeSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<DefRangeRegisterRelSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<BlockSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<LabelSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<ObjNameSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<Compile2Sym>::map(IO &IO) {}

template <> void SymbolRecordImpl<Compile3Sym>::map(IO &IO) {}

template <> void SymbolRecordImpl<FrameProcSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<CallSiteInfoSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<FileStaticSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<HeapAllocationSiteSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<FrameCookieSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<CallerSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<UDTSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<BuildInfoSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<BPRelativeSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<RegRelativeSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<ConstantSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<DataSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<ThreadLocalDataSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<UsingNamespaceSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<AnnotationSym>::map(IO &IO) {}

template <> void SymbolRecordImpl<JumpTableSym>::map(IO &IO) {}

} // end namespace detail
} // end namespace CodeViewYAML
} // end namespace llvm

CVSymbol CodeViewYAML::SymbolRecord::toCodeViewSymbol(
    BumpPtrAllocator &Allocator, CodeViewContainer Container) const {}

namespace llvm {
namespace yaml {

template <> struct MappingTraits<SymbolRecordBase> {};

} // end namespace yaml
} // end namespace llvm

template <typename SymbolType>
static inline Expected<CodeViewYAML::SymbolRecord>
fromCodeViewSymbolImpl(CVSymbol Symbol) {}

Expected<CodeViewYAML::SymbolRecord>
CodeViewYAML::SymbolRecord::fromCodeViewSymbol(CVSymbol Symbol) {}

template <typename ConcreteType>
static void mapSymbolRecordImpl(IO &IO, const char *Class, SymbolKind Kind,
                                CodeViewYAML::SymbolRecord &Obj) {}

void MappingTraits<CodeViewYAML::SymbolRecord>::mapping(
    IO &IO, CodeViewYAML::SymbolRecord &Obj) {}