Skip to content

Commit 82b3057

Browse files
committed
[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.
1 parent 99ce206 commit 82b3057

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

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

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111

1212
class AbiTagStructorsTestCase(TestBase):
13+
@skipIf(
14+
compiler="clang",
15+
compiler_version=["<", "22"],
16+
bugnumber="Required Clang flag not supported",
17+
)
1318
@expectedFailureAll(oslist=["windows"])
1419
def test_with_structor_linkage_names(self):
1520
self.build(dictionary={"CXXFLAGS_EXTRAS": "-gstructor-decl-linkage-names"})
@@ -73,7 +78,16 @@ def test_no_structor_linkage_names(self):
7378
Test that without linkage names on structor declarations we can't call
7479
ABI-tagged structors.
7580
"""
76-
self.build(dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"})
81+
# In older versions of Clang the -gno-structor-decl-linkage-names
82+
# behaviour was the default.
83+
if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
84+
[">=", "22.0"]
85+
):
86+
self.build(
87+
dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"}
88+
)
89+
else:
90+
self.build()
7791

7892
lldbutil.run_to_source_breakpoint(
7993
self, "Break here", lldb.SBFileSpec("main.cpp", False)
@@ -105,12 +119,23 @@ def do_nested_structor_test(self):
105119
"expression TaggedLocal()", error=True, substrs=["Couldn't look up symbols"]
106120
)
107121

122+
@skipIf(compiler="clang", compiler_version=["<", "22"])
108123
@expectedFailureAll(oslist=["windows"])
109-
def test_nested_no_structor_linkage_names(self):
124+
def test_nested_with_structor_linkage_names(self):
110125
self.build(dictionary={"CXXFLAGS_EXTRAS": "-gstructor-decl-linkage-names"})
111126
self.do_nested_structor_test()
112127

113128
@expectedFailureAll(oslist=["windows"])
114-
def test_nested_with_structor_linkage_names(self):
115-
self.build(dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"})
129+
def test_nested_no_structor_linkage_names(self):
130+
# In older versions of Clang the -gno-structor-decl-linkage-names
131+
# behaviour was the default.
132+
if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
133+
[">=", "22.0"]
134+
):
135+
self.build(
136+
dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"}
137+
)
138+
else:
139+
self.build()
140+
116141
self.do_nested_structor_test()

0 commit comments

Comments
 (0)