[lldb][Test] Check compiler in data forammter compiler version checks
authorMichael Buch <michaelbuch12@gmail.com>
Thu, 9 Feb 2023 16:00:04 +0000 (16:00 +0000)
committerMichael Buch <michaelbuch12@gmail.com>
Fri, 10 Feb 2023 01:37:26 +0000 (01:37 +0000)
**Summary**

The compiler version check wouldn't make sense for non-GCC
compilers, so check for the compiler too.

Differential Revision: https://reviews.llvm.org/D143656

17 files changed:
lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py
lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py
lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py

index f12f5f9..553095f 100644 (file)
@@ -20,7 +20,7 @@ class TestBasicDeque(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             deque_type = "std::deque<int>"
         else:
             deque_type = "std::deque<int, std::allocator<int> >"
index d62e49f..2867ea1 100644 (file)
@@ -21,7 +21,7 @@ class TestDbgInfoContentDeque(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             deque_type = "std::deque<Foo>"
         else:
             deque_type = "std::deque<Foo, std::allocator<Foo> >"
index ad6c5f4..79072be 100644 (file)
@@ -20,7 +20,7 @@ class TestDbgInfoContentForwardList(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             list_type = "std::forward_list<Foo>"
         else:
             list_type = "std::forward_list<Foo, std::allocator<Foo> >"
index 8cb6c13..4a872e1 100644 (file)
@@ -20,7 +20,7 @@ class TestBasicForwardList(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             list_type = "std::forward_list<int>"
         else:
             list_type = "std::forward_list<int, std::allocator<int> >"
index e67ff4b..58e516a 100644 (file)
@@ -22,7 +22,7 @@ class TestDbgInfoContentList(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             list_type = "std::list<Foo>"
         else:
             list_type = "std::list<Foo, std::allocator<Foo> >"
index b81e2c6..9ffc359 100644 (file)
@@ -20,7 +20,7 @@ class TestBasicList(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             list_type = "std::list<int>"
         else:
             list_type = "std::list<int, std::allocator<int> >"
index 8e3dca6..6431a64 100644 (file)
@@ -31,7 +31,7 @@ class TestCase(TestBase):
             ValueCheck(value="2"),
         ]
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             vector_type = "std::vector<int>"
             dbg_vec_type = "std::vector<DbgInfoClass>"
             module_vector_type = "std::vector<int>"
index d084083..b9ccb1e 100644 (file)
@@ -20,7 +20,7 @@ class TestQueue(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             queue_type = "std::queue<C>"
         else:
             queue_type = "std::queue<C, std::deque<C, std::allocator<C> > >"
@@ -56,7 +56,7 @@ class TestQueue(TestBase):
                          result_value="5")
 
         # Test std::queue functionality with a std::list.
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             queue_type = "std::queue<C, std::list<C> >"
         else:
             queue_type = "std::queue<C, std::list<C, std::allocator<C> > >"
index 7e6d6e0..4f8edc0 100644 (file)
@@ -14,7 +14,7 @@ class TestCase(TestBase):
                                           "// Set break point at this line.",
                                           lldb.SBFileSpec("main.cpp"))
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             vec_type = "std::vector<int>"
         else:
             vec_type = "std::vector<int, std::allocator<int> >"
index 3a219d9..9363631 100644 (file)
@@ -22,7 +22,7 @@ class TestUniquePtrDbgInfoContent(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             ptr_type = "std::unique_ptr<Foo>"
         else:
             ptr_type = "std::unique_ptr<Foo, std::default_delete<Foo> >"
index 01ee90b..1cf227e 100644 (file)
@@ -22,7 +22,7 @@ class TestUniquePtr(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             ptr_type = "std::unique_ptr<int>"
         else:
             ptr_type = "std::unique_ptr<int, std::default_delete<int> >"
index 6a411d7..8288271 100644 (file)
@@ -22,7 +22,7 @@ class TestDbgInfoContentVector(TestBase):
 
         self.runCmd("settings set target.import-std-module true")
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             vector_type = "std::vector<Foo>"
         else:
             vector_type = "std::vector<Foo, std::allocator<Foo> >"
index 4adc253..c516536 100644 (file)
@@ -18,7 +18,7 @@ class TestVectorOfVectors(TestBase):
                                           "// Set break point at this line.",
                                           lldb.SBFileSpec("main.cpp"))
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             vector_type = "std::vector<int>"
             vector_of_vector_type = "std::vector<std::vector<int> >"
         else:
index c8cf41b..81c7e70 100644 (file)
@@ -58,7 +58,7 @@ class TestCase(TestBase):
         self.assertRegex(valobj.summary, r"^10( strong=1)? weak=1$")
         self.assertNotEqual(valobj.child[0].unsigned, 0)
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             string_type = "std::basic_string<char>"
         else:
             string_type = "std::basic_string<char, std::char_traits<char>, std::allocator<char> >"
index d9803f4..34724e3 100644 (file)
@@ -52,7 +52,7 @@ class LibcxxStringDataFormatterTestCase(TestBase):
 
         ns = self.namespace
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             expected_basic_string = '%s::basic_string<unsigned char>'%ns
         else:
             expected_basic_string = '%s::basic_string<unsigned char, %s::char_traits<unsigned char>, ' \
index 4e5fcd1..08639c3 100644 (file)
@@ -56,7 +56,7 @@ class LibcxxStringViewDataFormatterTestCase(TestBase):
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             expected_basic_string = 'std::basic_string<unsigned char>'
             expected_basic_string_view = 'std::basic_string_view<unsigned char>'
         else:
index d9e1885..e31a3f1 100644 (file)
@@ -15,13 +15,13 @@ class TestCase(TestBase):
         if qualifiers:
             qualifiers = ' ' + qualifiers
 
-        if self.expectedCompilerVersion(['>', '16.0']):
+        if self.expectedCompiler(["clang"]) and 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']):
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(['>', '16.0']):
             return f'std::unique_ptr<std::basic_string<char> >'
         else:
             return 'std::unique_ptr<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, ' \