Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.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
15#include <cstdint>
16
17namespace llvm {
18
19class DWARFUnit;
21
22/// DWARFDebugInfoEntry - A DIE with only the minimum required data.
24 /// Offset within the .debug_info of the start of this entry.
25 uint64_t Offset = 0;
26
27 /// Index of the parent die. UINT32_MAX if there is no parent.
28 uint32_t ParentIdx = UINT32_MAX;
29
30 /// Index of the sibling die. Zero if there is no sibling.
31 uint32_t SiblingIdx = 0;
32
33 const DWARFAbbreviationDeclaration *AbbrevDecl = nullptr;
34
35public:
37
38 /// Extracts a debug info entry, which is a child of a given unit,
39 /// starting at a given offset. If DIE can't be extracted, returns false and
40 /// doesn't change OffsetPtr.
41 /// High performance extraction should use this call.
42 LLVM_ABI bool extractFast(const DWARFUnit &U, uint64_t *OffsetPtr,
43 const DWARFDataExtractor &DebugInfoData,
44 uint64_t UEndOffset, uint32_t ParentIdx);
45
46 uint64_t getOffset() const { return Offset; }
47
48 /// Returns index of the parent die.
49 std::optional<uint32_t> getParentIdx() const {
50 if (ParentIdx == UINT32_MAX)
51 return std::nullopt;
52
53 return ParentIdx;
54 }
55
56 /// Returns index of the sibling die.
57 std::optional<uint32_t> getSiblingIdx() const {
58 if (SiblingIdx == 0)
59 return std::nullopt;
60
61 return SiblingIdx;
62 }
63
64 /// Set index of sibling.
65 void setSiblingIdx(uint32_t Idx) { SiblingIdx = Idx; }
66
68 return AbbrevDecl ? AbbrevDecl->getTag() : dwarf::DW_TAG_null;
69 }
70
71 bool hasChildren() const { return AbbrevDecl && AbbrevDecl->hasChildren(); }
72
74 return AbbrevDecl;
75 }
76};
77
78} // end namespace llvm
79
80#endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGINFOENTRY_H
#define LLVM_ABI
Definition Compiler.h:213
This file contains constants used for implementing Dwarf debug support.
A DWARFDataExtractor (typically for an in-memory copy of an object-file section) plus a relocation ma...
void setSiblingIdx(uint32_t Idx)
Set index of sibling.
std::optional< uint32_t > getSiblingIdx() const
Returns index of the sibling die.
LLVM_ABI 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.