From 582bd6d2eeee8894931071d2020eb770602eb6e5 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 3 May 2024 17:27:01 +0100 Subject: [PATCH 1/3] [lldb][Type Completion][test] Un-XFAIL tests that pass with most recent redecl-completion fixes These were fixed in https://github.com/apple/llvm-project/pull/8659. --- .../API/functionalities/limit-debug-info/TestLimitDebugInfo.py | 3 --- lldb/test/API/lang/c/shared_lib/TestSharedLib.py | 2 -- .../TestSharedLibStrippedSymbols.py | 1 - 3 files changed, 6 deletions(-) diff --git a/lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py b/lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py index 9e15131c78e70..18371669462e2 100644 --- a/lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py +++ b/lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py @@ -183,7 +183,6 @@ def _check_incomplete_frame_variable_output(self): for command, expect_items in command_expect_pairs: self.expect(command, substrs=expect_items) - @expectedFailureAll(setting=('plugin.typesystem.clang.experimental-redecl-completion', 'true')) @skipIf(bugnumber="pr46284", debug_info="gmodules") @skipIfWindows # Clang emits type info even with -flimit-debug-info # Requires DW_CC_pass_by_* attributes from Clang 7 to correctly call @@ -224,7 +223,6 @@ def test_one_and_two_debug(self): self._check_incomplete_frame_variable_output() - @expectedFailureAll(setting=('plugin.typesystem.clang.experimental-redecl-completion', 'true')) @skipIf(bugnumber="pr46284", debug_info="gmodules") @skipIfWindows # Clang emits type info even with -flimit-debug-info # Requires DW_CC_pass_by_* attributes from Clang 7 to correctly call @@ -293,7 +291,6 @@ def test_two_debug(self): self._check_incomplete_frame_variable_output() - @expectedFailureAll(setting=('plugin.typesystem.clang.experimental-redecl-completion', 'true')) @skipIf(bugnumber="pr46284", debug_info="gmodules") @skipIfWindows # Clang emits type info even with -flimit-debug-info # Requires DW_CC_pass_by_* attributes from Clang 7 to correctly call diff --git a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py index b254db0b7afe0..b375aa6a86e14 100644 --- a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py +++ b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py @@ -26,12 +26,10 @@ def common_test_expr(self, preload_symbols): self.expect("expression GetMeASubFoo(my_foo_ptr)", startstr="(sub_foo *) $") - @expectedFailureAll(setting=('plugin.typesystem.clang.experimental-redecl-completion', 'true')) def test_expr(self): """Test that types work when defined in a shared library and forward-declared in the main executable""" self.common_test_expr(True) - @expectedFailureAll(setting=('plugin.typesystem.clang.experimental-redecl-completion', 'true')) def test_expr_no_preload(self): """Test that types work when defined in a shared library and forward-declared in the main executable, but with preloading disabled""" self.common_test_expr(False) diff --git a/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py index 1684533c0d5bb..f7035edddaf09 100644 --- a/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py +++ b/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py @@ -8,7 +8,6 @@ class SharedLibStrippedTestCase(TestBase): - @expectedFailureAll(setting=('plugin.typesystem.clang.experimental-redecl-completion', 'true')) @expectedFailureAll(oslist=["windows"]) def test_expr(self): """Test that types work when defined in a shared library and forwa/d-declared in the main executable""" From 41754cdb9c6460a118dab04d4aa6bc9211b5ec98 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 3 May 2024 17:29:52 +0100 Subject: [PATCH 2/3] [lldb][Type Completion] Comment assert to unblock buildbots for now We started hitting it after the fixes in https://github.com/apple/llvm-project/pull/8659. The assert can safely be disabled, so this patch does so to unblock CI. --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index f0c9273e98ee9..cbfe481efe85a 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -9510,7 +9510,8 @@ static void ConnectRedeclToPrev(TypeSystemClang &ts, T *prev, T *redecl) { // decl. ts.GetTypeForDecl(redecl); // The previous decl and the redeclaration both declare the same type. - assert(prev->getTypeForDecl() == redecl->getTypeForDecl()); + // FIXME: rdar://123500660, this is causing large number of test failures. + // assert(prev->getTypeForDecl() == redecl->getTypeForDecl()); } /// Returns the ClangModuleID for the given declaration. From 9507b8b2c4bccba565001b7d98f53b9cba658f8f Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 3 May 2024 20:09:33 +0100 Subject: [PATCH 3/3] [lldb][Type Completion] XFAIL TestExprCompletion and TestTypeLookup Expected failures due to lazy method loading (https://github.com/apple/llvm-project/pull/8579) --- .../completion/TestExprCompletion.py | 1 + .../type_lookup/TestTypeLookup.py | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lldb/test/API/commands/expression/completion/TestExprCompletion.py b/lldb/test/API/commands/expression/completion/TestExprCompletion.py index 22327f5e006c7..d2e24c694cdfd 100644 --- a/lldb/test/API/commands/expression/completion/TestExprCompletion.py +++ b/lldb/test/API/commands/expression/completion/TestExprCompletion.py @@ -252,6 +252,7 @@ def test_expr_completion(self): self.complete_from_to("expr myVec.__m", "expr myVec.__mem") self.complete_from_to("expr myVec._M", "expr myVec._Mem") + @expectedFailureAll(setting=('plugin.typesystem.clang.experimental-redecl-completion', 'true')) def test_expr_completion_with_descriptions(self): self.build() self.main_source = "main.cpp" diff --git a/lldb/test/API/functionalities/type_lookup/TestTypeLookup.py b/lldb/test/API/functionalities/type_lookup/TestTypeLookup.py index d9b04d6dd7f85..f735908c8b709 100644 --- a/lldb/test/API/functionalities/type_lookup/TestTypeLookup.py +++ b/lldb/test/API/functionalities/type_lookup/TestTypeLookup.py @@ -45,9 +45,24 @@ def test_type_lookup(self): "type lookup PleaseDontBeARealTypeThatExists", substrs=["no type was found matching 'PleaseDontBeARealTypeThatExists'"], ) - self.expect("type lookup MyCPPClass", substrs=["setF", "float getF"]) - self.expect("type lookup MyClass", substrs=["setF", "float getF"]) self.expect( "type lookup MyObjCClass", substrs=["@interface MyObjCClass", "int x", "int y"], ) + + @expectedFailureAll(setting=('plugin.typesystem.clang.experimental-redecl-completion', 'true')) + @skipUnlessDarwin + @skipIf(archs=["i386"]) + @skipIfDarwinEmbedded # swift crash inspecting swift stdlib with little other swift loaded + def test_type_lookup(self): + """Test type lookup command.""" + self.build() + self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) + + lldbutil.run_break_set_by_file_and_line( + self, "main.mm", self.line, num_expected_locations=1, loc_exact=True + ) + + self.runCmd("run", RUN_SUCCEEDED) + self.expect("type lookup MyCPPClass", substrs=["setF", "float getF"]) + self.expect("type lookup MyClass", substrs=["setF", "float getF"])