[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Don't overwrite DW_AT_object_pointer of definition with that of a declaration (PR #123089)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 15 14:46:09 PST 2025


================
@@ -377,7 +377,12 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE &die) {
       break;
 
     case DW_AT_object_pointer:
-      object_pointer = form_value.Reference();
+      // GetAttributes follows DW_AT_specification.
+      // DW_TAG_subprogram definitions and declarations may both
+      // have a DW_AT_object_pointer. Don't overwrite the one
+      // we parsed for the definition with the one from the declaration.
----------------
Michael137 wrote:

An alternative would be to say that `DW_AT_object_pointer` doesn't apply if we found it through a specification/abstract_origin ([like we do for `DW_AT_sibling` and `DW_AT_declaration` already](https://github.com/llvm/llvm-project/blob/d2e7ee77d33e8b3be3b1d4e9bc5bc4c60b62b554/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp#L312-L322)). The object pointer points to a child DIE, so I don't know why we would want to include it in the list of attributes when getting attributes of the definition. That feels like a more consistent/less intrusive approach. Wdyt?

If we ever find that we do for some reason want to include both `DW_AT_obejct_pointer`s in `GetAttributes`, then we can change it then?

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


More information about the lldb-commits mailing list