diff --git a/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py @@ -20,7 +20,11 @@ self.runCmd("settings set target.import-std-module true") - deque_type = "std::deque" + if self.expectedCompilerVersion(['>', '16.0']): + deque_type = "std::deque" + else: + deque_type = "std::deque >" + size_type = "size_type" value_type = "value_type" iterator = "iterator" diff --git a/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py @@ -21,7 +21,11 @@ self.runCmd("settings set target.import-std-module true") - deque_type = "std::deque" + if self.expectedCompilerVersion(['>', '16.0']): + deque_type = "std::deque" + else: + deque_type = "std::deque >" + size_type = "size_type" value_type = "value_type" diff --git a/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py @@ -20,7 +20,11 @@ self.runCmd("settings set target.import-std-module true") - list_type = "std::forward_list" + if self.expectedCompilerVersion(['>', '16.0']): + list_type = "std::forward_list" + else: + list_type = "std::forward_list >" + value_type = "value_type" # FIXME: This has three elements in it but the formatter seems to diff --git a/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py @@ -20,7 +20,11 @@ self.runCmd("settings set target.import-std-module true") - list_type = "std::forward_list" + if self.expectedCompilerVersion(['>', '16.0']): + list_type = "std::forward_list" + else: + list_type = "std::forward_list >" + value_type = "value_type" # FIXME: This has three elements in it but the formatter seems to diff --git a/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py @@ -22,7 +22,11 @@ self.runCmd("settings set target.import-std-module true") - list_type = "std::list" + if self.expectedCompilerVersion(['>', '16.0']): + list_type = "std::list" + else: + list_type = "std::list >" + size_type = "size_type" value_type = "value_type" diff --git a/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py @@ -20,7 +20,11 @@ self.runCmd("settings set target.import-std-module true") - list_type = "std::list" + if self.expectedCompilerVersion(['>', '16.0']): + list_type = "std::list" + else: + list_type = "std::list >" + size_type = "size_type" value_type = "value_type" diff --git a/lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py b/lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py --- a/lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py +++ b/lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py @@ -31,13 +31,20 @@ ValueCheck(value="2"), ] - vector_type = "std::vector" + if self.expectedCompilerVersion(['>', '16.0']): + vector_type = "std::vector" + dbg_vec_type = "std::vector" + module_vector_type = "std::vector" + else: + vector_type = "std::vector >" + dbg_vec_type = "std::vector >" + module_vector_type = "std::vector" # First muddy the scratch AST with non-C++ module types. self.expect_expr("a", result_type=vector_type, result_children=children) self.expect_expr("dbg_info_vec", - result_type="std::vector", + result_type=dbg_vec_type, result_children=[ ValueCheck(type="DbgInfoClass", children=[ ValueCheck(name="ints", type=vector_type, children=[ @@ -48,15 +55,15 @@ # Enable the C++ module import and get the module vector type. self.runCmd("settings set target.import-std-module true") - self.expect_expr("a", result_type=vector_type, + self.expect_expr("a", result_type=module_vector_type, result_children=children) # Test mixed debug info/module types self.expect_expr("dbg_info_vec", - result_type="std::vector", + result_type=dbg_vec_type, result_children=[ ValueCheck(type="DbgInfoClass", children=[ - ValueCheck(name="ints", type=vector_type, children=[ + ValueCheck(name="ints", type=module_vector_type, children=[ ValueCheck(value="1") ]) ]) @@ -70,7 +77,7 @@ # Test the types that were previoiusly mixed debug info/module types. self.expect_expr("dbg_info_vec", - result_type="std::vector", + result_type=dbg_vec_type, result_children=[ ValueCheck(type="DbgInfoClass", children=[ ValueCheck(name="ints", type=vector_type, children=[ diff --git a/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py @@ -20,7 +20,11 @@ self.runCmd("settings set target.import-std-module true") - queue_type = "std::queue" + if self.expectedCompilerVersion(['>', '16.0']): + queue_type = "std::queue" + else: + queue_type = "std::queue > >" + size_type = "size_type" value_type = "value_type" @@ -52,7 +56,11 @@ result_value="5") # Test std::queue functionality with a std::list. - queue_type = "std::queue >" + if self.expectedCompilerVersion(['>', '16.0']): + queue_type = "std::queue >" + else: + queue_type = "std::queue > >" + self.expect_expr( "q_list", result_type=queue_type, diff --git a/lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py b/lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py @@ -14,8 +14,13 @@ "// Set break point at this line.", lldb.SBFileSpec("main.cpp")) + if self.expectedCompilerVersion(['>', '16.0']): + vec_type = "std::vector" + else: + vec_type = "std::vector >" + # Test printing the vector before enabling any C++ module setting. - self.expect_expr("a", result_type="std::vector") + self.expect_expr("a", result_type=vec_type) # Set loading the import-std-module to 'fallback' which loads the module # and retries when an expression fails to parse. @@ -23,7 +28,7 @@ # Printing the vector still works. This should return the same type # as before as this shouldn't use a C++ module type. - self.expect_expr("a", result_type="std::vector") + self.expect_expr("a", result_type=vec_type) # This expression can only parse with a C++ module. LLDB should # automatically fall back to import the C++ module to get this working. diff --git a/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py b/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py --- a/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py +++ b/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py @@ -22,9 +22,14 @@ self.runCmd("settings set target.import-std-module true") + if self.expectedCompilerVersion(['>', '16.0']): + ptr_type = "std::unique_ptr" + else: + ptr_type = "std::unique_ptr >" + self.expect_expr( "s", - result_type="std::unique_ptr", + result_type=ptr_type, result_children=[ValueCheck(children=[ValueCheck(value="3")])]) self.expect_expr("s->a", result_type="int", result_value="3") self.expect_expr("s->a = 5", result_type="int", result_value="5") diff --git a/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py @@ -22,9 +22,14 @@ self.runCmd("settings set target.import-std-module true") + if self.expectedCompilerVersion(['>', '16.0']): + ptr_type = "std::unique_ptr" + else: + ptr_type = "std::unique_ptr >" + self.expect_expr( "s", - result_type="std::unique_ptr", + result_type=ptr_type, result_summary="3", result_children=[ValueCheck(name="__value_")]) self.expect_expr("*s", result_type="int", result_value="3") diff --git a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py @@ -22,7 +22,11 @@ self.runCmd("settings set target.import-std-module true") - vector_type = "std::vector" + if self.expectedCompilerVersion(['>', '16.0']): + vector_type = "std::vector" + else: + vector_type = "std::vector >" + size_type = "size_type" value_type = "value_type" iterator = "iterator" diff --git a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py --- a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py @@ -18,8 +18,12 @@ "// Set break point at this line.", lldb.SBFileSpec("main.cpp")) - vector_type = "std::vector" - vector_of_vector_type = "std::vector<" + vector_type + " >" + if self.expectedCompilerVersion(['>', '16.0']): + vector_type = "std::vector" + else: + vector_type = "std::vector" + vector_of_vector_type = "std::vector, std::allocator > >" + size_type = "size_type" value_type = "value_type" @@ -29,13 +33,13 @@ "a", result_type=vector_of_vector_type, result_children=[ - ValueCheck(type="std::vector", + ValueCheck(type=vector_type, children=[ ValueCheck(value='1'), ValueCheck(value='2'), ValueCheck(value='3'), ]), - ValueCheck(type="std::vector", + ValueCheck(type=vector_type, children=[ ValueCheck(value='3'), ValueCheck(value='2'), diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py @@ -58,9 +58,14 @@ self.assertRegex(valobj.summary, r"^10( strong=1)? weak=1$") self.assertNotEqual(valobj.child[0].unsigned, 0) + if self.expectedCompilerVersion(['>', '16.0']): + string_type = "std::basic_string" + else: + string_type = "std::basic_string, std::allocator >" + valobj = self.expect_var_path( "sp_str", - type="std::shared_ptr >", + type="std::shared_ptr<" + string_type + " >", children=[ValueCheck(name="__ptr_", summary='"hello"')], ) self.assertRegex(valobj.summary, r'^"hello"( strong=1)? weak=1$') diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py @@ -51,6 +51,13 @@ self.addTearDownHook(cleanup) ns = self.namespace + + if self.expectedCompilerVersion(['>', '16.0']): + expected_basic_string = '%s::basic_string'%ns + else: + expected_basic_string = '%s::basic_string, ' \ + '%s::allocator >'%(ns,ns,ns) + self.expect( "frame variable", substrs=[ @@ -70,7 +77,7 @@ '(%s::u32string) u32_string = U"🍄🍅🍆🍌"'%ns, # FIXME: This should have a 'U' prefix. '(%s::u32string) u32_empty = ""'%ns, - '(%s::basic_string) uchar = "aaaaa"'%(ns), + '(%s) uchar = "aaaaa"'%expected_basic_string, '(%s::string *) null_str = nullptr'%ns, ]) @@ -107,7 +114,7 @@ '(%s::u16string) u16_string = u"ß水氶"'%ns, '(%s::u32string) u32_string = U"🍄🍅🍆🍌"'%ns, '(%s::u32string) u32_empty = ""'%ns, - '(%s::basic_string) uchar = "aaaaa"'%(ns), + '(%s) uchar = "aaaaa"'%expected_basic_string, '(%s::string *) null_str = nullptr'%ns, ]) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py @@ -56,6 +56,13 @@ # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) + if self.expectedCompilerVersion(['>', '16.0']): + expected_basic_string = 'std::basic_string' + expected_basic_string_view = 'std::basic_string_view' + else: + expected_basic_string = 'std::basic_string, std::allocator >' + expected_basic_string_view = 'std::basic_string_view >' + self.expect_var_path('wempty', type='std::wstring_view', summary='L""') @@ -96,10 +103,10 @@ type='std::u32string_view', summary='""') self.expect_var_path('uchar_source', - type='std::basic_string', + type=expected_basic_string, summary='"aaaaaaaaaa"') self.expect_var_path('uchar', - type='std::basic_string_view', + type=expected_basic_string_view, summary='"aaaaa"') self.expect_var_path('oops', type='std::string_view', @@ -172,10 +179,10 @@ type='std::u32string_view', summary='""') self.expect_var_path('uchar_source', - type='std::basic_string', + type=expected_basic_string, summary='"aaaaaaaaaa"') self.expect_var_path('uchar', - type='std::basic_string_view', + type=expected_basic_string_view, summary='"aaaaa"') self.runCmd('cont') diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py @@ -11,6 +11,22 @@ class TestCase(TestBase): + def make_expected_type(self, pointee_type: str, qualifiers: str = "") -> str: + if qualifiers: + qualifiers = ' ' + qualifiers + + if self.expectedCompilerVersion(['>', '16.0']): + return f'std::unique_ptr<{pointee_type}>{qualifiers}' + else: + return f'std::unique_ptr<{pointee_type}, std::default_delete<{pointee_type}> >{qualifiers}' + + def make_expected_basic_string_ptr(self) -> str: + if self.expectedCompilerVersion(['>', '16.0']): + return f'std::unique_ptr >' + else: + return 'std::unique_ptr, std::allocator >, ' \ + 'std::default_delete, std::allocator > > >' + @add_test_categories(["libc++"]) def test_unique_ptr_variables(self): """Test `frame variable` output for `std::unique_ptr` types.""" @@ -22,7 +38,7 @@ valobj = self.expect_var_path( "up_empty", - type="std::unique_ptr", + type=self.make_expected_type("int"), summary="nullptr", children=[ValueCheck(name="__value_")], ) @@ -36,7 +52,7 @@ valobj = self.expect_var_path( "up_int", - type="std::unique_ptr", + type=self.make_expected_type("int"), summary="10", children=[ValueCheck(name="__value_")], ) @@ -44,7 +60,7 @@ valobj = self.expect_var_path( "up_int_ref", - type="std::unique_ptr &", + type=self.make_expected_type("int", qualifiers="&"), summary="10", children=[ValueCheck(name="__value_")], ) @@ -52,7 +68,7 @@ valobj = self.expect_var_path( "up_int_ref_ref", - type="std::unique_ptr &&", + type=self.make_expected_type("int", qualifiers="&&"), summary="10", children=[ValueCheck(name="__value_")], ) @@ -60,13 +76,13 @@ valobj = self.expect_var_path( "up_str", - type="std::unique_ptr >", + type=self.make_expected_basic_string_ptr(), summary='"hello"', children=[ValueCheck(name="__value_", summary='"hello"')], ) valobj = self.expect_var_path( - "up_user", type="std::unique_ptr" + "up_user", type=self.make_expected_type("User") ) self.assertRegex(valobj.summary, "^User @ 0x0*[1-9a-f][0-9a-f]+$") self.assertNotEqual(valobj.child[0].unsigned, 0)