[Lldb-commits] [lldb] 82b3057 - [lldb][test] TestAbiTagStructors.py adjust test to account for older compiler versions

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 2 05:49:11 PDT 2025


Author: Michael Buch
Date: 2025-10-02T13:48:46+01:00
New Revision: 82b3057a5ec552d5e42bb595c8243e4fac0c70b4

URL: https://github.com/llvm/llvm-project/commit/82b3057a5ec552d5e42bb595c8243e4fac0c70b4
DIFF: https://github.com/llvm/llvm-project/commit/82b3057a5ec552d5e42bb595c8243e4fac0c70b4.diff

LOG: [lldb][test] TestAbiTagStructors.py adjust test to account for older compiler versions

Skip tests that require `-gstructor-decl-linkage-names` on Clang
versions that don't support it.

Don't pass `-gno-structor-decl-linkage-names` on Clang versions where it
the flag didn't exist but it was the default behaviour of the compiler
anyway.

Added: 
    

Modified: 
    lldb/test/API/lang/cpp/abi_tag_structors/TestAbiTagStructors.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lang/cpp/abi_tag_structors/TestAbiTagStructors.py b/lldb/test/API/lang/cpp/abi_tag_structors/TestAbiTagStructors.py
index 87d8adb42b82e..2d3e4f7cdd472 100644
--- a/lldb/test/API/lang/cpp/abi_tag_structors/TestAbiTagStructors.py
+++ b/lldb/test/API/lang/cpp/abi_tag_structors/TestAbiTagStructors.py
@@ -10,6 +10,11 @@
 
 
 class AbiTagStructorsTestCase(TestBase):
+    @skipIf(
+        compiler="clang",
+        compiler_version=["<", "22"],
+        bugnumber="Required Clang flag not supported",
+    )
     @expectedFailureAll(oslist=["windows"])
     def test_with_structor_linkage_names(self):
         self.build(dictionary={"CXXFLAGS_EXTRAS": "-gstructor-decl-linkage-names"})
@@ -73,7 +78,16 @@ def test_no_structor_linkage_names(self):
         Test that without linkage names on structor declarations we can't call
         ABI-tagged structors.
         """
-        self.build(dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"})
+        # In older versions of Clang the -gno-structor-decl-linkage-names
+        # behaviour was the default.
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
+            [">=", "22.0"]
+        ):
+            self.build(
+                dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"}
+            )
+        else:
+            self.build()
 
         lldbutil.run_to_source_breakpoint(
             self, "Break here", lldb.SBFileSpec("main.cpp", False)
@@ -105,12 +119,23 @@ def do_nested_structor_test(self):
             "expression TaggedLocal()", error=True, substrs=["Couldn't look up symbols"]
         )
 
+    @skipIf(compiler="clang", compiler_version=["<", "22"])
     @expectedFailureAll(oslist=["windows"])
-    def test_nested_no_structor_linkage_names(self):
+    def test_nested_with_structor_linkage_names(self):
         self.build(dictionary={"CXXFLAGS_EXTRAS": "-gstructor-decl-linkage-names"})
         self.do_nested_structor_test()
 
     @expectedFailureAll(oslist=["windows"])
-    def test_nested_with_structor_linkage_names(self):
-        self.build(dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"})
+    def test_nested_no_structor_linkage_names(self):
+        # In older versions of Clang the -gno-structor-decl-linkage-names
+        # behaviour was the default.
+        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
+            [">=", "22.0"]
+        ):
+            self.build(
+                dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"}
+            )
+        else:
+            self.build()
+
         self.do_nested_structor_test()


        


More information about the lldb-commits mailing list