Skip to content

[lldb][test] Move std::span from libcxx to generic directory #147680

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 2 commits into from
Jul 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
CXX_SOURCES := main.cpp

USE_LIBCPP := 1

CXXFLAGS_EXTRAS := -std=c++20

include Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from lldbsuite.test import lldbutil


class LibcxxSpanDataFormatterTestCase(TestBase):
class StdSpanDataFormatterTestCase(TestBase):
def findVariable(self, name):
var = self.frame().FindVariable(name)
self.assertTrue(var.IsValid())
Expand Down Expand Up @@ -44,11 +44,8 @@ def check_numbers(self, var_name):
self.expect_var_path(f"{var_name}[3]", type="int", value="1234")
self.expect_var_path(f"{var_name}[4]", type="int", value="12345")

@add_test_categories(["libc++"])
@skipIf(compiler="clang", compiler_version=["<", "11.0"])
def test_with_run_command(self):
def do_test(self):
"""Test that std::span variables are formatted correctly when printed."""
self.build()
(self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
self, "break here", lldb.SBFileSpec("main.cpp", False)
)
Expand Down Expand Up @@ -158,11 +155,14 @@ def test_with_run_command(self):
)
self.check_size("nested", 2)

@add_test_categories(["libc++"])
@skipIf(compiler="clang", compiler_version=["<", "11.0"])
def test_ref_and_ptr(self):
@add_test_categories(["libc++"])
def test_libcxx(self):
self.build(dictionary={"USE_LIBCPP": 1})
self.do_test()

def do_test_ref_and_ptr(self):
"""Test that std::span is correctly formatted when passed by ref and ptr"""
self.build()
(self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
self, "Stop here to check by ref", lldb.SBFileSpec("main.cpp", False)
)
Expand All @@ -173,3 +173,9 @@ def test_ref_and_ptr(self):
# The pointer should just show the right number of elements:

self.expect("frame variable ptr", patterns=["ptr = 0x[0-9a-f]+ size=5"])

@skipIf(compiler="clang", compiler_version=["<", "11.0"])
@add_test_categories(["libc++"])
def test_ref_and_ptr_libcxx(self):
self.build(dictionary={"USE_LIBCPP": 1})
self.do_test_ref_and_ptr()
Loading