diff options
Diffstat (limited to 'lib/ObjectYAML/CodeViewYAMLDebugSections.cpp')
-rw-r--r-- | lib/ObjectYAML/CodeViewYAMLDebugSections.cpp | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp b/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp index d194420d5ef46..60b0ea28030a2 100644 --- a/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp +++ b/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp @@ -13,9 +13,11 @@ //===----------------------------------------------------------------------===// #include "llvm/ObjectYAML/CodeViewYAMLDebugSections.h" - +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" -#include "llvm/ADT/StringSwitch.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/BinaryFormat/COFF.h" +#include "llvm/DebugInfo/CodeView/CodeView.h" #include "llvm/DebugInfo/CodeView/CodeViewError.h" #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h" #include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h" @@ -24,15 +26,29 @@ #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h" #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h" #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h" +#include "llvm/DebugInfo/CodeView/DebugSubsection.h" #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h" #include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h" #include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h" -#include "llvm/DebugInfo/CodeView/EnumTables.h" +#include "llvm/DebugInfo/CodeView/Line.h" #include "llvm/DebugInfo/CodeView/StringsAndChecksums.h" -#include "llvm/DebugInfo/CodeView/SymbolRecord.h" -#include "llvm/DebugInfo/CodeView/SymbolSerializer.h" +#include "llvm/DebugInfo/CodeView/TypeIndex.h" #include "llvm/ObjectYAML/CodeViewYAMLSymbols.h" -#include "llvm/Support/BinaryStreamWriter.h" +#include "llvm/Support/Allocator.h" +#include "llvm/Support/BinaryStreamReader.h" +#include "llvm/Support/Endian.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/YAMLTraits.h" +#include "llvm/Support/raw_ostream.h" +#include <algorithm> +#include <cassert> +#include <cstdint> +#include <memory> +#include <string> +#include <tuple> +#include <vector> + using namespace llvm; using namespace llvm::codeview; using namespace llvm::CodeViewYAML; @@ -48,9 +64,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(InlineeSite) LLVM_YAML_IS_SEQUENCE_VECTOR(InlineeInfo) LLVM_YAML_IS_SEQUENCE_VECTOR(CrossModuleExport) LLVM_YAML_IS_SEQUENCE_VECTOR(YAMLCrossModuleImport) -LLVM_YAML_IS_SEQUENCE_VECTOR(StringRef) LLVM_YAML_IS_SEQUENCE_VECTOR(YAMLFrameData) -LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint32_t) LLVM_YAML_DECLARE_SCALAR_TRAITS(HexFormattedString, false) LLVM_YAML_DECLARE_ENUM_TRAITS(DebugSubsectionKind) @@ -70,21 +84,25 @@ LLVM_YAML_DECLARE_MAPPING_TRAITS(InlineeSite) namespace llvm { namespace CodeViewYAML { namespace detail { + struct YAMLSubsectionBase { explicit YAMLSubsectionBase(DebugSubsectionKind Kind) : Kind(Kind) {} - DebugSubsectionKind Kind; - virtual ~YAMLSubsectionBase() {} + virtual ~YAMLSubsectionBase() = default; virtual void map(IO &IO) = 0; virtual std::shared_ptr<DebugSubsection> toCodeViewSubsection(BumpPtrAllocator &Allocator, const codeview::StringsAndChecksums &SC) const = 0; + + DebugSubsectionKind Kind; }; -} -} -} + +} // end namespace detail +} // end namespace CodeViewYAML +} // end namespace llvm namespace { + struct YAMLChecksumsSubsection : public YAMLSubsectionBase { YAMLChecksumsSubsection() : YAMLSubsectionBase(DebugSubsectionKind::FileChecksums) {} @@ -215,7 +233,8 @@ struct YAMLCoffSymbolRVASubsection : public YAMLSubsectionBase { std::vector<uint32_t> RVAs; }; -} + +} // end anonymous namespace void ScalarBitSetTraits<LineFlags>::bitset(IO &io, LineFlags &Flags) { io.bitSetCase(Flags, "HasColumnInfo", LF_HaveColumns); @@ -743,8 +762,9 @@ llvm::CodeViewYAML::toCodeViewSubsectionList( } namespace { + struct SubsectionConversionVisitor : public DebugSubsectionVisitor { - SubsectionConversionVisitor() {} + SubsectionConversionVisitor() = default; Error visitUnknown(DebugUnknownSubsectionRef &Unknown) override; Error visitLines(DebugLinesSubsectionRef &Lines, @@ -769,6 +789,8 @@ struct SubsectionConversionVisitor : public DebugSubsectionVisitor { YAMLDebugSubsection Subsection; }; +} // end anonymous namespace + Error SubsectionConversionVisitor::visitUnknown( DebugUnknownSubsectionRef &Unknown) { return make_error<CodeViewError>(cv_error_code::operation_unsupported); @@ -865,7 +887,6 @@ Error SubsectionConversionVisitor::visitCOFFSymbolRVAs( Subsection.Subsection = *Result; return Error::success(); } -} Expected<YAMLDebugSubsection> YAMLDebugSubsection::fromCodeViewSubection(const StringsAndChecksumsRef &SC, |