[Lldb-commits] [lldb] [lldb][test] Add test for detecting CV-quals of explicit object member functions (PR #125053)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 30 04:32:30 PST 2025


https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/125053

>From 310d7d6362a2f36503a9d8f94713fdb16c3bf65c Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Thu, 30 Jan 2025 12:04:59 +0000
Subject: [PATCH 1/3] [lldb][test] Add test for detecting CV-quals of explicit
 object member functions

This is XFAILed for now until we find a good way to locate the
DW_AT_object_pointer of function declarations (a possible solution being
https://github.com/llvm/llvm-project/pull/124790).
---
 .../DWARF/explicit-member-function-quals.cpp  | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp

diff --git a/lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp b/lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp
new file mode 100644
index 00000000000000..8e742600dc10e9
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp
@@ -0,0 +1,22 @@
+// XFAIL: *
+
+// Tests that we correctly deduce the CV-quals and storage
+// class of explicit object member functions.
+//
+// RUN: %clangxx_host %s -g -std=c++23 -c -o %t
+// RUN: %lldb %t -b -o "type lookup Foo" 2>&1 | FileCheck %s
+//
+// CHECK:      (lldb) type lookup Foo
+// CHECK-NEXT: struct Foo {
+// CHECK-NEXT:      void Method(Foo);
+// CHECK-NEXT:      void cMethod(Foo const&);
+// CHECK-NEXT:      void vMethod(Foo volatile&);
+// CHECK-NEXT:      void cvMethod(const Foo volatile&) const volatile;
+// CHECK-NEXT: }
+
+struct Foo {
+  void Method(this Foo) {}
+  void cMethod(this Foo const&) {}
+  void vMethod(this Foo volatile&) {}
+  void cvMethod(this Foo const volatile&) {}
+} f;

>From 27405d65cb112bc0ad90bd5133c7ca0a6cd8407c Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Thu, 30 Jan 2025 12:17:32 +0000
Subject: [PATCH 2/3] fixup! clang-format

---
 .../SymbolFile/DWARF/explicit-member-function-quals.cpp     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp b/lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp
index 8e742600dc10e9..675d964323b884 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp
@@ -16,7 +16,7 @@
 
 struct Foo {
   void Method(this Foo) {}
-  void cMethod(this Foo const&) {}
-  void vMethod(this Foo volatile&) {}
-  void cvMethod(this Foo const volatile&) {}
+  void cMethod(this Foo const &) {}
+  void vMethod(this Foo volatile &) {}
+  void cvMethod(this Foo const volatile &) {}
 } f;

>From c0c2ba1acf588c3531d3414715ca04018c7b2d27 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Thu, 30 Jan 2025 12:31:48 +0000
Subject: [PATCH 3/3] fixup! specify triple explicitly

---
 .../DWARF/{ => x86}/explicit-member-function-quals.cpp          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename lldb/test/Shell/SymbolFile/DWARF/{ => x86}/explicit-member-function-quals.cpp (89%)

diff --git a/lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/explicit-member-function-quals.cpp
similarity index 89%
rename from lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp
rename to lldb/test/Shell/SymbolFile/DWARF/x86/explicit-member-function-quals.cpp
index 675d964323b884..bda9bb99f04a0f 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/explicit-member-function-quals.cpp
@@ -3,7 +3,7 @@
 // Tests that we correctly deduce the CV-quals and storage
 // class of explicit object member functions.
 //
-// RUN: %clangxx_host %s -g -std=c++23 -c -o %t
+// RUN: %clangxx_host %s -triple x86_64-pc-linux -g -std=c++23 -c -o %t
 // RUN: %lldb %t -b -o "type lookup Foo" 2>&1 | FileCheck %s
 //
 // CHECK:      (lldb) type lookup Foo



More information about the lldb-commits mailing list