LLVM 19.0.0git
DWARFDebugInfoEntry.h
Go to the documentation of this file.
1//===- DWARFDebugInfoEntry.h ------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGINFOENTRY_H
10#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGINFOENTRY_H
11
14#include <cstdint>
15
16namespace llvm {
17
18class DWARFUnit;
19class DWARFDataExtractor;
20
21/// DWARFDebugInfoEntry - A DIE with only the minimum required data.
23 /// Offset within the .debug_info of the start of this entry.
24 uint64_t Offset = 0;
25
26 /// Index of the parent die. UINT32_MAX if there is no parent.
27 uint32_t ParentIdx = UINT32_MAX;
28
29 /// Index of the sibling die. Zero if there is no sibling.
30 uint32_t SiblingIdx = 0;
31
32 const DWARFAbbreviationDeclaration *AbbrevDecl = nullptr;
33
34public:
36
37 /// Extracts a debug info entry, which is a child of a given unit,
38 /// starting at a given offset. If DIE can't be extracted, returns false and
39 /// doesn't change OffsetPtr.
40 /// High performance extraction should use this call.
41 bool extractFast(const DWARFUnit &U, uint64_t *OffsetPtr,
42 const DWARFDataExtractor &DebugInfoData, uint64_t UEndOffset,
43 uint32_t ParentIdx);
44
45 uint64_t getOffset() const { return Offset; }
46
47 /// Returns index of the parent die.
48 std::optional<uint32_t> getParentIdx() const {
49 if (ParentIdx == UINT32_MAX)
50 return std::nullopt;
51
52 return ParentIdx;
53 }
54
55 /// Returns index of the sibling die.
56 std::optional<uint32_t> getSiblingIdx() const {
57 if (SiblingIdx == 0)
58 return std::nullopt;
59
60 return SiblingIdx;
61 }
62
63 /// Set index of sibling.
64 void setSiblingIdx(uint32_t Idx) { SiblingIdx = Idx; }
65
67 return AbbrevDecl ? AbbrevDecl->getTag() : dwarf::DW_TAG_null;
68 }
69
70 bool hasChildren() const { return AbbrevDecl && AbbrevDecl->hasChildren(); }
71
73 return AbbrevDecl;
74 }
75};
76
77} // end namespace llvm
78
79#endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGINFOENTRY_H
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file contains constants used for implementing Dwarf debug support.
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
DWARFDebugInfoEntry - A DIE with only the minimum required data.
void setSiblingIdx(uint32_t Idx)
Set index of sibling.
std::optional< uint32_t > getSiblingIdx() const
Returns index of the sibling die.
bool extractFast(const DWARFUnit &U, uint64_t *OffsetPtr, const DWARFDataExtractor &DebugInfoData, uint64_t UEndOffset, uint32_t ParentIdx)
Extracts a debug info entry, which is a child of a given unit, starting at a given offset.
std::optional< uint32_t > getParentIdx() const
Returns index of the parent die.
const DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18