[llvm] [DebugNames] Implement Entry::GetParentEntry query (PR #78760)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 09:38:53 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;
----------------
felipepiovezan wrote:

So, given this discussion, I would like to propose we move forward with the interface as is.
As much as it _looks_ off, I did put a lot of thought into this and given that our brainstorm session here did not yield a better result, it seems appropriate.
This interface catches the reader's attention -- as it should -- because there are nuances on the return value that are only explained by reading the docs.

https://github.com/llvm/llvm-project/pull/78760


More information about the llvm-commits mailing list