[all-commits] [llvm/llvm-project] dd5d73: [lldb] Better matching of types in anonymous names...
Pavel Labath via All-commits
all-commits at lists.llvm.org
Sun Sep 1 23:34:36 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: dd5d73007240712957f2b633f795d9965afaadd6
https://github.com/llvm/llvm-project/commit/dd5d73007240712957f2b633f795d9965afaadd6
Author: Pavel Labath <pavel at labath.sk>
Date: 2024-09-02 (Mon, 02 Sep 2024)
Changed paths:
M lldb/include/lldb/Symbol/Type.h
M lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
M lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
M lldb/source/Symbol/Type.cpp
M lldb/test/API/lang/cpp/dynamic-value/Makefile
M lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py
A lldb/test/API/lang/cpp/dynamic-value/a.h
A lldb/test/API/lang/cpp/dynamic-value/anonymous-b.cpp
M lldb/test/API/lang/cpp/dynamic-value/pass-to-base.cpp
M lldb/test/API/lang/cpp/namespace/TestNamespace.py
M lldb/unittests/Symbol/TestType.cpp
M lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp
Log Message:
-----------
[lldb] Better matching of types in anonymous namespaces (#102111)
This patch extends TypeQuery matching to support anonymous namespaces. A
new flag is added to control the behavior. In the "strict" mode, the
query must match the type exactly -- all anonymous namespaces included.
The dynamic type resolver in the itanium abi (the motivating use case
for this) uses this flag, as it queries using the name from the
demangles, which includes anonymous namespaces.
This ensures we don't confuse a type with a same-named type in an
anonymous namespace. However, this does *not* ensure we don't confuse
two types in anonymous namespacs (in different CUs). To resolve this, we
would need to use a completely different lookup algorithm, which
probably also requires a DWARF extension.
In the "lax" mode (the default), the anonymous namespaces in the query
are optional, and this allows one search for the type using the usual
language rules (`::A` matches `::(anonymous namespace)::A`).
This patch also changes the type context computation algorithm in
DWARFDIE, so that it includes anonymous namespace information. This
causes a slight change in behavior: the algorithm previously stopped
computing the context after encountering an anonymous namespace, which
caused the outer namespaces to be ignored. This meant that a type like
`NS::(anonymous namespace)::A` would be (incorrectly) recognized as
`::A`). This can cause code depending on the old behavior to misbehave.
The fix is to specify all the enclosing namespaces in the query, or use
a non-exact match.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list