Author: Michael Buch Date: 2025-10-02T14:08:40+01:00 New Revision: faf070f062ac7f3861092ab110982a613d7dfe1b
URL: https://github.com/llvm/llvm-project/commit/faf070f062ac7f3861092ab110982a613d7dfe1b DIFF: https://github.com/llvm/llvm-project/commit/faf070f062ac7f3861092ab110982a613d7dfe1b.diff LOG: [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()")`. Added: Modified: lldb/test/API/lang/cpp/expr-definition-in-dylib/TestExprDefinitionInDylib.py Removed: ################################################################################ diff --git a/lldb/test/API/lang/cpp/expr-definition-in-dylib/TestExprDefinitionInDylib.py b/lldb/test/API/lang/cpp/expr-definition-in-dylib/TestExprDefinitionInDylib.py index c0545c70c84ea..b3bed43c75873 100644 --- a/lldb/test/API/lang/cpp/expr-definition-in-dylib/TestExprDefinitionInDylib.py +++ b/lldb/test/API/lang/cpp/expr-definition-in-dylib/TestExprDefinitionInDylib.py @@ -6,6 +6,11 @@ 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 @@ def test_no_structor_linkage_names(self): 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 @@ def test_no_structor_linkage_names(self): 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) _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
