Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/ObjectYAML/DWARFYAML.h
Show All 33 Lines | |||||
struct Abbrev { | struct Abbrev { | ||||
Optional<yaml::Hex64> Code; | Optional<yaml::Hex64> Code; | ||||
llvm::dwarf::Tag Tag; | llvm::dwarf::Tag Tag; | ||||
llvm::dwarf::Constants Children; | llvm::dwarf::Constants Children; | ||||
std::vector<AttributeAbbrev> Attributes; | std::vector<AttributeAbbrev> Attributes; | ||||
}; | }; | ||||
struct AbbrevTable { | |||||
Optional<uint64_t> ID; | |||||
std::vector<Abbrev> Table; | |||||
}; | |||||
struct ARangeDescriptor { | struct ARangeDescriptor { | ||||
llvm::yaml::Hex64 Address; | llvm::yaml::Hex64 Address; | ||||
yaml::Hex64 Length; | yaml::Hex64 Length; | ||||
}; | }; | ||||
struct ARange { | struct ARange { | ||||
dwarf::DwarfFormat Format; | dwarf::DwarfFormat Format; | ||||
Optional<yaml::Hex64> Length; | Optional<yaml::Hex64> Length; | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
struct Unit { | struct Unit { | ||||
dwarf::DwarfFormat Format; | dwarf::DwarfFormat Format; | ||||
Optional<yaml::Hex64> Length; | Optional<yaml::Hex64> Length; | ||||
uint16_t Version; | uint16_t Version; | ||||
Optional<uint8_t> AddrSize; | Optional<uint8_t> AddrSize; | ||||
llvm::dwarf::UnitType Type; // Added in DWARF 5 | llvm::dwarf::UnitType Type; // Added in DWARF 5 | ||||
Optional<uint64_t> AbbrevTableID; | |||||
yaml::Hex64 AbbrOffset; | yaml::Hex64 AbbrOffset; | ||||
std::vector<Entry> Entries; | std::vector<Entry> Entries; | ||||
}; | }; | ||||
struct File { | struct File { | ||||
StringRef Name; | StringRef Name; | ||||
uint64_t DirIdx; | uint64_t DirIdx; | ||||
uint64_t ModTime; | uint64_t ModTime; | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | template <typename EntryType> struct ListTable { | ||||
Optional<uint32_t> OffsetEntryCount; | Optional<uint32_t> OffsetEntryCount; | ||||
Optional<std::vector<yaml::Hex64>> Offsets; | Optional<std::vector<yaml::Hex64>> Offsets; | ||||
std::vector<ListEntries<EntryType>> Lists; | std::vector<ListEntries<EntryType>> Lists; | ||||
}; | }; | ||||
struct Data { | struct Data { | ||||
bool IsLittleEndian; | bool IsLittleEndian; | ||||
bool Is64BitAddrSize; | bool Is64BitAddrSize; | ||||
std::vector<Abbrev> AbbrevDecls; | std::vector<AbbrevTable> DebugAbbrev; | ||||
std::vector<StringRef> DebugStrings; | std::vector<StringRef> DebugStrings; | ||||
Optional<std::vector<StringOffsetsTable>> DebugStrOffsets; | Optional<std::vector<StringOffsetsTable>> DebugStrOffsets; | ||||
Optional<std::vector<ARange>> DebugAranges; | Optional<std::vector<ARange>> DebugAranges; | ||||
std::vector<Ranges> DebugRanges; | std::vector<Ranges> DebugRanges; | ||||
std::vector<AddrTableEntry> DebugAddr; | std::vector<AddrTableEntry> DebugAddr; | ||||
Optional<PubSection> PubNames; | Optional<PubSection> PubNames; | ||||
Optional<PubSection> PubTypes; | Optional<PubSection> PubTypes; | ||||
Optional<PubSection> GNUPubNames; | Optional<PubSection> GNUPubNames; | ||||
Optional<PubSection> GNUPubTypes; | Optional<PubSection> GNUPubTypes; | ||||
std::vector<Unit> CompileUnits; | std::vector<Unit> CompileUnits; | ||||
std::vector<LineTable> DebugLines; | std::vector<LineTable> DebugLines; | ||||
Optional<std::vector<ListTable<RnglistEntry>>> DebugRnglists; | Optional<std::vector<ListTable<RnglistEntry>>> DebugRnglists; | ||||
Optional<std::vector<ListTable<LoclistEntry>>> DebugLoclists; | Optional<std::vector<ListTable<LoclistEntry>>> DebugLoclists; | ||||
bool isEmpty() const; | bool isEmpty() const; | ||||
SetVector<StringRef> getNonEmptySectionNames() const; | SetVector<StringRef> getNonEmptySectionNames() const; | ||||
}; | }; | ||||
} // end namespace DWARFYAML | } // end namespace DWARFYAML | ||||
} // end namespace llvm | } // end namespace llvm | ||||
jhenderson: Something to consider here: the user-visible behaviour of this class is that this is a `const`… | |||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::AttributeAbbrev) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::AttributeAbbrev) | ||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Abbrev) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Abbrev) | ||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::AbbrevTable) | |||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARangeDescriptor) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARangeDescriptor) | ||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARange) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARange) | ||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::RangeEntry) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::RangeEntry) | ||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Ranges) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Ranges) | ||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::PubEntry) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::PubEntry) | ||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Unit) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Unit) | ||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::FormValue) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::FormValue) | ||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Entry) | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Entry) | ||||
Show All 17 Lines | |||||
namespace llvm { | namespace llvm { | ||||
namespace yaml { | namespace yaml { | ||||
template <> struct MappingTraits<DWARFYAML::Data> { | template <> struct MappingTraits<DWARFYAML::Data> { | ||||
static void mapping(IO &IO, DWARFYAML::Data &DWARF); | static void mapping(IO &IO, DWARFYAML::Data &DWARF); | ||||
}; | }; | ||||
template <> struct MappingTraits<DWARFYAML::AbbrevTable> { | |||||
static void mapping(IO &IO, DWARFYAML::AbbrevTable &AbbrevTable); | |||||
}; | |||||
template <> struct MappingTraits<DWARFYAML::Abbrev> { | template <> struct MappingTraits<DWARFYAML::Abbrev> { | ||||
static void mapping(IO &IO, DWARFYAML::Abbrev &Abbrev); | static void mapping(IO &IO, DWARFYAML::Abbrev &Abbrev); | ||||
}; | }; | ||||
template <> struct MappingTraits<DWARFYAML::AttributeAbbrev> { | template <> struct MappingTraits<DWARFYAML::AttributeAbbrev> { | ||||
static void mapping(IO &IO, DWARFYAML::AttributeAbbrev &AttAbbrev); | static void mapping(IO &IO, DWARFYAML::AttributeAbbrev &AttAbbrev); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines |
Something to consider here: the user-visible behaviour of this class is that this is a const operation, but because this method causes AbbrevTableID2Index to be populated on the first call, it technically isn't. I would say this is a reasonable use case for mutable - the cache (in this case AbbrevTableID2Index) is marked as mutable, and then you can continue to pass this class around as const.