[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
Thu Jan 16 02:33:31 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:

Actually that comment sounds like the intention was to only consider an attribute once. Which is not what this function is doing. Wonder if that's something worth trying to do as well. I.e., fix iteration order, but separately also make sure duplicate attributes don't get overwritten? I'm not sure it's ever desirable (examples are `DW_AT_object_pointer` and `DW_AT_low_pc`)

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


More information about the lldb-commits mailing list