File indexing completed on 2026-05-10 08:43:41
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGINFOENTRY_H
0010 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGINFOENTRY_H
0011
0012 #include "llvm/BinaryFormat/Dwarf.h"
0013 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
0014 #include <cstdint>
0015
0016 namespace llvm {
0017
0018 class DWARFUnit;
0019 class DWARFDataExtractor;
0020
0021
0022 class DWARFDebugInfoEntry {
0023
0024 uint64_t Offset = 0;
0025
0026
0027 uint32_t ParentIdx = UINT32_MAX;
0028
0029
0030 uint32_t SiblingIdx = 0;
0031
0032 const DWARFAbbreviationDeclaration *AbbrevDecl = nullptr;
0033
0034 public:
0035 DWARFDebugInfoEntry() = default;
0036
0037
0038
0039
0040
0041 bool extractFast(const DWARFUnit &U, uint64_t *OffsetPtr,
0042 const DWARFDataExtractor &DebugInfoData, uint64_t UEndOffset,
0043 uint32_t ParentIdx);
0044
0045 uint64_t getOffset() const { return Offset; }
0046
0047
0048 std::optional<uint32_t> getParentIdx() const {
0049 if (ParentIdx == UINT32_MAX)
0050 return std::nullopt;
0051
0052 return ParentIdx;
0053 }
0054
0055
0056 std::optional<uint32_t> getSiblingIdx() const {
0057 if (SiblingIdx == 0)
0058 return std::nullopt;
0059
0060 return SiblingIdx;
0061 }
0062
0063
0064 void setSiblingIdx(uint32_t Idx) { SiblingIdx = Idx; }
0065
0066 dwarf::Tag getTag() const {
0067 return AbbrevDecl ? AbbrevDecl->getTag() : dwarf::DW_TAG_null;
0068 }
0069
0070 bool hasChildren() const { return AbbrevDecl && AbbrevDecl->hasChildren(); }
0071
0072 const DWARFAbbreviationDeclaration *getAbbreviationDeclarationPtr() const {
0073 return AbbrevDecl;
0074 }
0075 };
0076
0077 }
0078
0079 #endif