Skip to content

[lldb][test] Add test for detecting CV-quals of explicit object member functions #125053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 30, 2025

Conversation

Michael137
Copy link
Member

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 #124790).

Made it a shell test because I couldn't find any SBAPIs that i could query to find the CV-qualifiers/etc. of member functions.

…r 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
llvm#124790).
@Michael137 Michael137 requested a review from labath January 30, 2025 12:07
@llvmbot llvmbot added the lldb label Jan 30, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 30, 2025

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

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 #124790).

Made it a shell test because I couldn't find any SBAPIs that i could query to find the CV-qualifiers/etc. of member functions.


Full diff: https://github.com/llvm/llvm-project/pull/125053.diff

1 Files Affected:

  • (added) lldb/test/Shell/SymbolFile/DWARF/explicit-member-function-quals.cpp (+22)
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;

// 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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The representation here doesn't look right also. But that's a separate bug probably with the AST that LLDB creates

Copy link

github-actions bot commented Jan 30, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

// 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need -gdwarf to produce dwarf on windows. But maybe it's better to hardcode your favourite triple for reproducibility?

@Michael137 Michael137 merged commit 4b57236 into llvm:main Jan 30, 2025
7 checks passed
@Michael137 Michael137 deleted the lldb/explicit-this-tests branch January 30, 2025 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants