[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()")`.
This commit is contained in:
@@ -6,6 +6,11 @@ from lldbsuite.test import lldbutil
|
||||
|
||||
class ExprDefinitionInDylibTestCase(TestBase):
|
||||
|
||||
@skipIf(
|
||||
compiler="clang",
|
||||
compiler_version=["<", "22"],
|
||||
bugnumber="Required Clang flag not supported",
|
||||
)
|
||||
@skipIfWindows
|
||||
def test_with_structor_linkage_names(self):
|
||||
"""
|
||||
@@ -74,7 +79,16 @@ class ExprDefinitionInDylibTestCase(TestBase):
|
||||
Tests that if structor declarations don't have linkage names, we can't
|
||||
call ABI-tagged constructors. But non-tagged ones are fine.
|
||||
"""
|
||||
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()
|
||||
|
||||
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
|
||||
self.assertTrue(target, VALID_TARGET)
|
||||
@@ -95,6 +109,6 @@ class ExprDefinitionInDylibTestCase(TestBase):
|
||||
|
||||
self.expect_expr("Foo(10)", result_type="Foo")
|
||||
|
||||
self.expect("Base()", error=True)
|
||||
self.expect("expr Base()", error=True)
|
||||
|
||||
self.expect("Bar()", error=True)
|
||||
self.expect("expr Bar()", error=True)
|
||||
|
||||
Reference in New Issue
Block a user