Skip to content

Commit faf070f

Browse files
committed
[lldb][test] TestExprDefinitionInDylib.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. Drive-by: - We used to run `self.expect("Bar()")` which would always fail. So the `error=True` would be true even if we didn't pass the `-gno-structor-linkage-names`. So it wasn't testing the behaviour properly. This patch changes these to `self.expect("expr Bar()")`.
1 parent e7839ee commit faf070f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

lldb/test/API/lang/cpp/expr-definition-in-dylib/TestExprDefinitionInDylib.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
class ExprDefinitionInDylibTestCase(TestBase):
88

9+
@skipIf(
10+
compiler="clang",
11+
compiler_version=["<", "22"],
12+
bugnumber="Required Clang flag not supported",
13+
)
914
@skipIfWindows
1015
def test_with_structor_linkage_names(self):
1116
"""
@@ -74,7 +79,16 @@ def test_no_structor_linkage_names(self):
7479
Tests that if structor declarations don't have linkage names, we can't
7580
call ABI-tagged constructors. But non-tagged ones are fine.
7681
"""
77-
self.build(dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"})
82+
# In older versions of Clang the -gno-structor-decl-linkage-names
83+
# behaviour was the default.
84+
if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
85+
[">=", "22.0"]
86+
):
87+
self.build(
88+
dictionary={"CXXFLAGS_EXTRAS": "-gno-structor-decl-linkage-names"}
89+
)
90+
else:
91+
self.build()
7892

7993
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
8094
self.assertTrue(target, VALID_TARGET)
@@ -95,6 +109,6 @@ def test_no_structor_linkage_names(self):
95109

96110
self.expect_expr("Foo(10)", result_type="Foo")
97111

98-
self.expect("Base()", error=True)
112+
self.expect("expr Base()", error=True)
99113

100-
self.expect("Bar()", error=True)
114+
self.expect("expr Bar()", error=True)

0 commit comments

Comments
 (0)