[all-commits] [llvm/llvm-project] 09ad10: [lldb][NativePDB] Use decl context from a method's...

Nerixyz via All-commits all-commits at lists.llvm.org
Thu May 28 11:51:47 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 09ad10052903ad38aa770642ae5c6a7115c92e5e
      https://github.com/llvm/llvm-project/commit/09ad10052903ad38aa770642ae5c6a7115c92e5e
  Author: Nerixyz <nerixdev at outlook.de>
  Date:   2026-05-28 (Thu, 28 May 2026)

  Changed paths:
    M lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilderClang.cpp
    M lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilderClang.h
    M lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
    M lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
    A lldb/test/Shell/SymbolFile/NativePDB/ast-lambdas-msvc.cpp
    A lldb/test/Shell/SymbolFile/NativePDB/ast-lambdas.cpp

  Log Message:
  -----------
  [lldb][NativePDB] Use decl context from a method's class (#199221)

When we look up the parent decl context for a method, we used to look
for that by name. For "regular" types that works well.
Say, we have a `struct ns::Foo` and `ns::Foo::bar`. We'd search for
`ns::Foo` and use its context.

For special types - mainly lambdas - this doesn't work. They can't be
found by looking for the name we get from the function symbol. That name
won't be in the TPI hash table we use.

I'm not fully sure under which name they're in that table. For example,
if we get the name `Foo::fun::<lambda_1>::operator()` from the function
symbol, we'd look for `Foo::fun::<lambda_1>`. This fails. A class with
this name is actually present, but it has a different unique name. Its
unique name demangles to `` `public: void __cdecl
Foo::fun(void)'::`1'::<lambda_1> `` which doesn't match what we searched
for. That might be the issue.

If we can't find a class/struct, we create namespaces. So before, we
created namespaces for each segment and added a regular function inside.
This was wrong for methods.

However, we can tell that a function is a method by looking at its
function type. And we know the parent class from this type. With this PR
that parent class is used if it's available.



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