[llvm] [DebugNames] Implement Entry::GetParentEntry query (PR #78760)
Paul T Robinson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 13:20:25 PST 2024
================
@@ -460,6 +460,16 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
/// Returns the Offset of the DIE within the containing CU or TU.
std::optional<uint64_t> getDIEUnitOffset() const;
+ /// Returns true if this Entry has information about its parent DIE (i.e. if
+ /// it has an IDX_parent attribute)
+ bool hasParentInformation() const;
+
+ /// Returns the Entry corresponding to the parent of the DIE represented by
+ /// `this` Entry. If the parent is not in the table, nullopt is returned.
+ /// Precondition: hasParentInformation() == true.
+ /// An error is returned for ill-formed tables.
+ Expected<std::optional<DWARFDebugNames::Entry>> getParentDIEEntry() const;
----------------
pogo59 wrote:
(Drive-by) can you return some kind of no-data error for the parent-not-present case?
https://github.com/llvm/llvm-project/pull/78760
More information about the llvm-commits
mailing list