Skip to content

[llvm] annotate interfaces in llvm/ObjectYAML for DLL export #143763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions llvm/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/YAMLTraits.h"
#include <cstdint>
Expand Down Expand Up @@ -108,23 +109,24 @@ struct InlineeInfo {
};

struct YAMLDebugSubsection {
static Expected<YAMLDebugSubsection>
LLVM_ABI static Expected<YAMLDebugSubsection>
fromCodeViewSubection(const codeview::StringsAndChecksumsRef &SC,
const codeview::DebugSubsectionRecord &SS);

std::shared_ptr<detail::YAMLSubsectionBase> Subsection;
};

Expected<std::vector<std::shared_ptr<codeview::DebugSubsection>>>
LLVM_ABI Expected<std::vector<std::shared_ptr<codeview::DebugSubsection>>>
toCodeViewSubsectionList(BumpPtrAllocator &Allocator,
ArrayRef<YAMLDebugSubsection> Subsections,
const codeview::StringsAndChecksums &SC);

std::vector<YAMLDebugSubsection>
LLVM_ABI std::vector<YAMLDebugSubsection>
fromDebugS(ArrayRef<uint8_t> Data, const codeview::StringsAndChecksumsRef &SC);

void initializeStringsAndChecksums(ArrayRef<YAMLDebugSubsection> Sections,
codeview::StringsAndChecksums &SC);
LLVM_ABI void
initializeStringsAndChecksums(ArrayRef<YAMLDebugSubsection> Sections,
codeview::StringsAndChecksums &SC);

} // end namespace CodeViewYAML

Expand Down
6 changes: 4 additions & 2 deletions llvm/include/llvm/ObjectYAML/CodeViewYAMLSymbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/YAMLTraits.h"
#include <memory>
Expand All @@ -32,11 +33,12 @@ struct SymbolRecordBase;
struct SymbolRecord {
std::shared_ptr<detail::SymbolRecordBase> Symbol;

codeview::CVSymbol
LLVM_ABI codeview::CVSymbol
toCodeViewSymbol(BumpPtrAllocator &Allocator,
codeview::CodeViewContainer Container) const;

static Expected<SymbolRecord> fromCodeViewSymbol(codeview::CVSymbol Symbol);
LLVM_ABI static Expected<SymbolRecord>
fromCodeViewSymbol(codeview::CVSymbol Symbol);
};

} // end namespace CodeViewYAML
Expand Down
14 changes: 8 additions & 6 deletions llvm/include/llvm/ObjectYAML/CodeViewYAMLTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/YAMLTraits.h"
#include <cstdint>
Expand Down Expand Up @@ -45,15 +46,16 @@ struct MemberRecord {
struct LeafRecord {
std::shared_ptr<detail::LeafRecordBase> Leaf;

codeview::CVType
LLVM_ABI codeview::CVType
toCodeViewRecord(codeview::AppendingTypeTableBuilder &Serializer) const;
static Expected<LeafRecord> fromCodeViewRecord(codeview::CVType Type);
LLVM_ABI static Expected<LeafRecord>
fromCodeViewRecord(codeview::CVType Type);
};

std::vector<LeafRecord> fromDebugT(ArrayRef<uint8_t> DebugTorP,
StringRef SectionName);
ArrayRef<uint8_t> toDebugT(ArrayRef<LeafRecord>, BumpPtrAllocator &Alloc,
StringRef SectionName);
LLVM_ABI std::vector<LeafRecord> fromDebugT(ArrayRef<uint8_t> DebugTorP,
StringRef SectionName);
LLVM_ABI ArrayRef<uint8_t>
toDebugT(ArrayRef<LeafRecord>, BumpPtrAllocator &Alloc, StringRef SectionName);

} // end namespace CodeViewYAML

Expand Down
39 changes: 20 additions & 19 deletions llvm/include/llvm/ObjectYAML/DWARFEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/TargetParser/Host.h"
Expand All @@ -27,26 +28,26 @@ namespace DWARFYAML {

struct Data;

Error emitDebugAbbrev(raw_ostream &OS, const Data &DI);
Error emitDebugStr(raw_ostream &OS, const Data &DI);

Error emitDebugAranges(raw_ostream &OS, const Data &DI);
Error emitDebugRanges(raw_ostream &OS, const Data &DI);
Error emitDebugPubnames(raw_ostream &OS, const Data &DI);
Error emitDebugPubtypes(raw_ostream &OS, const Data &DI);
Error emitDebugGNUPubnames(raw_ostream &OS, const Data &DI);
Error emitDebugGNUPubtypes(raw_ostream &OS, const Data &DI);
Error emitDebugInfo(raw_ostream &OS, const Data &DI);
Error emitDebugLine(raw_ostream &OS, const Data &DI);
Error emitDebugAddr(raw_ostream &OS, const Data &DI);
Error emitDebugStrOffsets(raw_ostream &OS, const Data &DI);
Error emitDebugRnglists(raw_ostream &OS, const Data &DI);
Error emitDebugLoclists(raw_ostream &OS, const Data &DI);
Error emitDebugNames(raw_ostream &OS, const Data &DI);

std::function<Error(raw_ostream &, const Data &)>
LLVM_ABI Error emitDebugAbbrev(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugStr(raw_ostream &OS, const Data &DI);

LLVM_ABI Error emitDebugAranges(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugRanges(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugPubnames(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugPubtypes(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugGNUPubnames(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugGNUPubtypes(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugInfo(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugLine(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugAddr(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugStrOffsets(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugRnglists(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugLoclists(raw_ostream &OS, const Data &DI);
LLVM_ABI Error emitDebugNames(raw_ostream &OS, const Data &DI);

LLVM_ABI std::function<Error(raw_ostream &, const Data &)>
getDWARFEmitterByName(StringRef SecName);
Expected<StringMap<std::unique_ptr<MemoryBuffer>>>
LLVM_ABI Expected<StringMap<std::unique_ptr<MemoryBuffer>>>
emitDebugSections(StringRef YAMLString,
bool IsLittleEndian = sys::IsLittleEndianHost,
bool Is64BitAddrSize = true);
Expand Down
64 changes: 34 additions & 30 deletions llvm/include/llvm/ObjectYAML/DWARFYAML.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/ObjectYAML/YAML.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/YAMLTraits.h"
#include <cstdint>
#include <optional>
Expand Down Expand Up @@ -255,16 +256,16 @@ struct Data {
std::optional<std::vector<ListTable<LoclistEntry>>> DebugLoclists;
std::optional<DebugNamesSection> DebugNames;

bool isEmpty() const;
LLVM_ABI bool isEmpty() const;

SetVector<StringRef> getNonEmptySectionNames() const;
LLVM_ABI SetVector<StringRef> getNonEmptySectionNames() const;

struct AbbrevTableInfo {
uint64_t Index;
uint64_t Offset;
};
Expected<AbbrevTableInfo> getAbbrevTableInfoByID(uint64_t ID) const;
StringRef getAbbrevTableContentByIndex(uint64_t Index) const;
LLVM_ABI Expected<AbbrevTableInfo> getAbbrevTableInfoByID(uint64_t ID) const;
LLVM_ABI StringRef getAbbrevTableContentByIndex(uint64_t Index) const;

private:
mutable std::unordered_map<uint64_t, AbbrevTableInfo> AbbrevTableInfoMap;
Expand Down Expand Up @@ -310,88 +311,90 @@ namespace llvm {
namespace yaml {

template <> struct MappingTraits<DWARFYAML::Data> {
static void mapping(IO &IO, DWARFYAML::Data &DWARF);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::Data &DWARF);
};

template <> struct MappingTraits<DWARFYAML::AbbrevTable> {
static void mapping(IO &IO, DWARFYAML::AbbrevTable &AbbrevTable);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::AbbrevTable &AbbrevTable);
};

template <> struct MappingTraits<DWARFYAML::Abbrev> {
static void mapping(IO &IO, DWARFYAML::Abbrev &Abbrev);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::Abbrev &Abbrev);
};

template <> struct MappingTraits<DWARFYAML::AttributeAbbrev> {
static void mapping(IO &IO, DWARFYAML::AttributeAbbrev &AttAbbrev);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::AttributeAbbrev &AttAbbrev);
};

template <> struct MappingTraits<DWARFYAML::ARangeDescriptor> {
static void mapping(IO &IO, DWARFYAML::ARangeDescriptor &Descriptor);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::ARangeDescriptor &Descriptor);
};

template <> struct MappingTraits<DWARFYAML::ARange> {
static void mapping(IO &IO, DWARFYAML::ARange &ARange);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::ARange &ARange);
};

template <> struct MappingTraits<DWARFYAML::RangeEntry> {
static void mapping(IO &IO, DWARFYAML::RangeEntry &Entry);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::RangeEntry &Entry);
};

template <> struct MappingTraits<DWARFYAML::Ranges> {
static void mapping(IO &IO, DWARFYAML::Ranges &Ranges);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::Ranges &Ranges);
};

template <> struct MappingTraits<DWARFYAML::PubEntry> {
static void mapping(IO &IO, DWARFYAML::PubEntry &Entry);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::PubEntry &Entry);
};

template <> struct MappingTraits<DWARFYAML::PubSection> {
static void mapping(IO &IO, DWARFYAML::PubSection &Section);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::PubSection &Section);
};

template <> struct MappingTraits<DWARFYAML::Unit> {
static void mapping(IO &IO, DWARFYAML::Unit &Unit);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::Unit &Unit);
};

template <> struct MappingTraits<DWARFYAML::DebugNamesSection> {
static void mapping(IO &IO, DWARFYAML::DebugNamesSection &);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::DebugNamesSection &);
};
template <> struct MappingTraits<DWARFYAML::DebugNameEntry> {
static void mapping(IO &IO, DWARFYAML::DebugNameEntry &);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::DebugNameEntry &);
};
template <> struct MappingTraits<DWARFYAML::DebugNameAbbreviation> {
static void mapping(IO &IO, DWARFYAML::DebugNameAbbreviation &);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::DebugNameAbbreviation &);
};
template <> struct MappingTraits<DWARFYAML::IdxForm> {
static void mapping(IO &IO, DWARFYAML::IdxForm &);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::IdxForm &);
};

template <> struct MappingTraits<DWARFYAML::Entry> {
static void mapping(IO &IO, DWARFYAML::Entry &Entry);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::Entry &Entry);
};

template <> struct MappingTraits<DWARFYAML::FormValue> {
static void mapping(IO &IO, DWARFYAML::FormValue &FormValue);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::FormValue &FormValue);
};

template <> struct MappingTraits<DWARFYAML::File> {
static void mapping(IO &IO, DWARFYAML::File &File);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::File &File);
};

template <> struct MappingTraits<DWARFYAML::LineTableOpcode> {
static void mapping(IO &IO, DWARFYAML::LineTableOpcode &LineTableOpcode);
LLVM_ABI static void mapping(IO &IO,
DWARFYAML::LineTableOpcode &LineTableOpcode);
};

template <> struct MappingTraits<DWARFYAML::LineTable> {
static void mapping(IO &IO, DWARFYAML::LineTable &LineTable);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::LineTable &LineTable);
};

template <> struct MappingTraits<DWARFYAML::SegAddrPair> {
static void mapping(IO &IO, DWARFYAML::SegAddrPair &SegAddrPair);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::SegAddrPair &SegAddrPair);
};

template <> struct MappingTraits<DWARFYAML::DWARFOperation> {
static void mapping(IO &IO, DWARFYAML::DWARFOperation &DWARFOperation);
LLVM_ABI static void mapping(IO &IO,
DWARFYAML::DWARFOperation &DWARFOperation);
};

template <typename EntryType>
Expand All @@ -407,19 +410,20 @@ struct MappingTraits<DWARFYAML::ListEntries<EntryType>> {
};

template <> struct MappingTraits<DWARFYAML::RnglistEntry> {
static void mapping(IO &IO, DWARFYAML::RnglistEntry &RnglistEntry);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::RnglistEntry &RnglistEntry);
};

template <> struct MappingTraits<DWARFYAML::LoclistEntry> {
static void mapping(IO &IO, DWARFYAML::LoclistEntry &LoclistEntry);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::LoclistEntry &LoclistEntry);
};

template <> struct MappingTraits<DWARFYAML::AddrTableEntry> {
static void mapping(IO &IO, DWARFYAML::AddrTableEntry &AddrTable);
LLVM_ABI static void mapping(IO &IO, DWARFYAML::AddrTableEntry &AddrTable);
};

template <> struct MappingTraits<DWARFYAML::StringOffsetsTable> {
static void mapping(IO &IO, DWARFYAML::StringOffsetsTable &StrOffsetsTable);
LLVM_ABI static void mapping(IO &IO,
DWARFYAML::StringOffsetsTable &StrOffsetsTable);
};

template <> struct ScalarEnumerationTraits<dwarf::DwarfFormat> {
Expand Down
Loading
Loading