diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2025-01-17 13:09:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-17 13:09:52 +0000 |
commit | 5153a90453e692b834e38eec247a0c88a0678bfa (patch) | |
tree | ba4e79f65b2ddace68dae0907ce22b2ec52b1a87 /llvm/unittests/ADT/StringTableTest.cpp | |
parent | 41f430a48db992477534b65b288b47d487c4797d (diff) | |
download | llvm-5153a90453e692b834e38eec247a0c88a0678bfa.zip llvm-5153a90453e692b834e38eec247a0c88a0678bfa.tar.gz llvm-5153a90453e692b834e38eec247a0c88a0678bfa.tar.bz2 |
[lldb][DWARF] Change GetAttributes to always visit current DIE before recursing (#123261)
`GetAttributes` returns all attributes on a given DIE, including any
attributes that the DIE references via `DW_AT_abstract_origin` and
`DW_AT_specification`. However, if an attribute exists on both the
referring DIE and the referenced DIE, the first one encountered will be
the one that takes precendence when querying the returned
`DWARFAttributes`. But there was no guarantee in which order those
attributes get visited. That means there's no convenient way of ensuring
that an attribute of a definition doesn't get shadowed by one found on
the declaration. One use-case where we don't want this to happen is for
`DW_AT_object_pointer` (which can exist on both definitions and
declarations, see https://github.com/llvm/llvm-project/pull/123089).
This patch makes sure we visit the current DIE's attributes before
following DIE references. I tried keeping as much of the original
`GetAttributes` unchanged and just add an outer `GetAttributes` that
keeps track of the DIEs we need to visit next.
There's precendent for this iteration order in
`llvm::DWARFDie::findRecursively` and also
`lldb_private::ElaboratingDIEIterator`. We could use the latter to
implement `GetAttributes`, though it also follows `DW_AT_signature` so I
decided to leave it for follow-up.
Diffstat (limited to 'llvm/unittests/ADT/StringTableTest.cpp')
0 files changed, 0 insertions, 0 deletions