[Lldb-commits] [lldb] [lldb][NativePDB] Use decl context from a method's class (PR #199221)

via lldb-commits lldb-commits at lists.llvm.org
Thu May 28 02:13:18 PDT 2026


================
@@ -0,0 +1,46 @@
+// clang-format off
+// REQUIRES: msvc
+
+// RUN: %build --compiler=msvc --nodefaultlib --std c++20 -o %t.exe -- %s
+// RUN: lldb-test symbols --dump-ast %t.exe | FileCheck %s
+
+class Foo {
+public:
+  void fun() {
+    auto f = [this]() {
+      int c = a;
+      int d = b;
+      return a + b;
+    };
+    f();
+    int local = 42;
+    auto g = [=]() mutable {
+      return local + 1;
+    };
+    g();
+  }
+
+private:
+  int a = 1;
+  int b = 2;
+};
+
+int main() {
+  Foo f;
+  f.fun();
+  return 0;
+}
+
+// CHECK:      namespace `public: void __cdecl Foo::fun(void)'::`{{.*}}' {
+// CHECK-NEXT:     class <lambda_1> {
+// CHECK:              int `Foo::fun'::`{{.*}}'::<lambda_1>::operator()() const;
+// CHECK:              int operator()() const;
----------------
Nerixyz wrote:

> Do you mean the second `operator()` is from the an extra function type record that MSVC generated while clang doesn't do it so we only see one `operator()` in the non-msvc test?

Yes.

> Can we deduplicate that in lldb?

In this case, we can do that. See https://github.com/llvm/llvm-project/pull/199221#discussion_r3316631576.

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


More information about the lldb-commits mailing list