[llvm] [DebugNames] Implement Entry::GetParentEntry query (PR #78760)
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 14:45:50 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;
----------------
adrian-prantl wrote:
I think you reinvented std::optional there ;-)
https://github.com/llvm/llvm-project/pull/78760
More information about the llvm-commits
mailing list