Skip to content

[lldb][test] Move std::function from libcxx to generic directory #147701

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Michael137
Copy link
Member

This just moves the test from libcxx to generic. There are currently no std::function formatters for libstdc++ so I didn't add a test-case for it.

Split out from #146740

@Michael137 Michael137 requested a review from JDevlieghere as a code owner July 9, 2025 11:33
@llvmbot llvmbot added the lldb label Jul 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

This just moves the test from libcxx to generic. There are currently no std::function formatters for libstdc++ so I didn't add a test-case for it.

Split out from #146740


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

3 Files Affected:

  • (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/Makefile (-2)
  • (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py (+8-6)
  • (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp ()
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/Makefile
similarity index 51%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/Makefile
index b016f006747da..99998b20bcb05 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/Makefile
@@ -1,5 +1,3 @@
 CXX_SOURCES := main.cpp
-CXXFLAGS_EXTRAS := -std=c++11
-USE_LIBCPP := 1
 
 include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py
similarity index 92%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py
index 80461b996328f..64d704c07c0ae 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py
@@ -2,14 +2,13 @@
 Test lldb data formatter subsystem.
 """
 
-
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
 
-class LibCxxFunctionTestCase(TestBase):
+class StdFunctionTestCase(TestBase):
     # Run frame var for a variable twice. Verify we do not hit the cache
     # the first time but do the second time.
     def run_frame_var_check_cache_use(
@@ -34,10 +33,8 @@ def run_frame_var_check_cache_use(
             substrs=["lldb_private::CompileUnit::FindFunction"],
         )
 
-    @add_test_categories(["libc++"])
-    def test(self):
-        """Test that std::function as defined by libc++ is correctly printed by LLDB"""
-        self.build()
+    def do_test(self):
+        """Test that std::function is correctly printed by LLDB"""
         self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
 
         bkpt = self.target().FindBreakpointByID(
@@ -82,3 +79,8 @@ def test(self):
         self.expect(
             "frame variable f5", substrs=["f5 =  Function = Bar::add_num(int) const"]
         )
+
+    @add_test_categories(["libc++"])
+    def test_libcxx(self):
+        self.build(dictionary={"USE_LIBCPP": 1})
+        self.do_test()
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp
similarity index 100%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp

Copy link

github-actions bot commented Jul 9, 2025

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

This just moves the test from `libcxx` to `generic`. There are currently no `std::function` formatters for libstdc++ so I didn't add a test-case for it.

Split out from llvm#146740
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