[Lldb-commits] [lldb] [lldb][test] Move std::unordered_map::iterator from libcxx to generic… (PR #147703)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 9 04:34:19 PDT 2025


https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/147703

… directory

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

Split out from https://github.com/llvm/llvm-project/pull/146740

>From fb6fd676eb47ecd26871ce573260df04bd95dcc4 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Wed, 9 Jul 2025 13:10:26 +0100
Subject: [PATCH] [lldb][test] Move std::unordered_map::iterator from libcxx to
 generic directory

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

Split out from https://github.com/llvm/llvm-project/pull/146740
---
 .../unordered_map-iterator/Makefile           |  3 ---
 .../TestDataFormatterStdUnorderedMap.py}      | 27 ++++++++++++-------
 .../unordered_map-iterator/main.cpp           |  0
 3 files changed, 17 insertions(+), 13 deletions(-)
 rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/unordered_map-iterator/Makefile (54%)
 rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py => generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py} (92%)
 rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/unordered_map-iterator/main.cpp (100%)

diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile
similarity index 54%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile
index 564cbada74e08..99998b20bcb05 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile
@@ -1,6 +1,3 @@
 CXX_SOURCES := main.cpp
 
-USE_LIBCPP := 1
-
-CXXFLAGS_EXTRAS := -O0
 include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py
similarity index 92%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py
index a338e3c12598e..d2382373f4810 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMap.py
@@ -8,7 +8,7 @@
 from lldbsuite.test import lldbutil
 
 
-class LibcxxUnorderedMapDataFormatterTestCase(TestBase):
+class StdUnorderedMapDataFormatterTestCase(TestBase):
     def check_ptr_or_ref(self, var_name: str):
         var = self.frame().FindVariable(var_name)
         self.assertTrue(var)
@@ -32,12 +32,10 @@ def check_ptr_ptr(self, var_name: str):
         self.assertEqual(pair.GetChildAtIndex(0).summary, '"Hello"')
         self.assertEqual(pair.GetChildAtIndex(1).summary, '"World"')
 
-    @add_test_categories(["libc++"])
-    def test_iterator_formatters(self):
+    def do_test(self):
         """Test that std::unordered_map related structures are formatted correctly when printed.
         Currently only tests format of std::unordered_map iterators.
         """
-        self.build()
         (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
             self, "Break here", lldb.SBFileSpec("main.cpp", False)
         )
@@ -105,13 +103,12 @@ def test_iterator_formatters(self):
             type="const StringMapT *const &",
         )
 
-    @expectedFailureAll(
-        bugnumber="https://github.com/llvm/llvm-project/issues/146040",
-        compiler="clang",
-        compiler_version=["<", "21"],
-    )
     @add_test_categories(["libc++"])
-    def test_ptr_formatters(self):
+    def test_libcxx(self):
+        self.build(dictionary={"USE_LIBCPP": 1})
+        self.do_test()
+
+    def do_test_ptr(self):
         """
         Test that pointers to std::unordered_map are formatted correctly.
         """
@@ -127,3 +124,13 @@ def test_ptr_formatters(self):
         self.check_ptr_ptr("ptr4")
         self.check_ptr_ptr("ptr5")
         self.check_ptr_ptr("ptr6")
+
+    @expectedFailureAll(
+        bugnumber="https://github.com/llvm/llvm-project/issues/146040",
+        compiler="clang",
+        compiler_version=["<", "21"],
+    )
+    @add_test_categories(["libc++"])
+    def test_ptr_libcxx(self):
+        self.build(dictionary={"USE_LIBCPP": 1})
+        self.do_test_ptr()
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/main.cpp
similarity index 100%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/main.cpp
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/main.cpp



More information about the lldb-commits mailing list