[all-commits] [llvm/llvm-project] f8c9b3: [lldb][SymbolFileDWARF] Support by-name lookup of ...
Michael Buch via All-commits
all-commits at lists.llvm.org
Thu Feb 2 03:35:59 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f8c9b30eb3e8cffc6c7adaa3003c774422643cf7
https://github.com/llvm/llvm-project/commit/f8c9b30eb3e8cffc6c7adaa3003c774422643cf7
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2023-02-02 (Thu, 02 Feb 2023)
Changed paths:
M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
M lldb/test/API/commands/expression/inline-namespace/TestInlineNamespace.py
M lldb/test/API/commands/expression/inline-namespace/main.cpp
Log Message:
-----------
[lldb][SymbolFileDWARF] Support by-name lookup of global variables in inline namespaces
Currently evaluating an expression involving a global variable inside
an inline namespace will fail to lookup said variable. This is because
the `SymbolFileDWARF::FindGlobalVariables` discards from consideration
all DIEs whose decl_context doesn't exactly match that of the lookup.
This patch relaxes this restriction by checking whether C++ rules
would permit the lookup. This is permitted by the DWARFv5 spec in
chapter `3.2.2 Namespace Entries`:
```
A namespace may have a DW_AT_export_symbols attribute which is a flag
which indicates that all member names defined within the namespace may be
referenced as if they were defined within the containing namespace.
```
The motivation for this is evaluating `std::ranges` expressions, which
heavily rely on global variables inside inline namespaces. E.g.,
`std::views::all(...)` is just an invocation of the `operator()`
on `std::ranges::views::__cpo::all`.
**Testing**
* Added API tests
Differential Revision: https://reviews.llvm.org/D143068
More information about the All-commits
mailing list