From 8df85020904ff7004a437824f37610bdf207d454 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 22 May 2020 09:05:00 +0200 Subject: [PATCH] Clang: Disable a completion test for LLVM/Clang 10 For the case struct Foo; void f(Foo *foo) { foo->/*COMPLETE-HERE*/ } no completions are expected as "Foo" is only forward declared. This seems to be handled correctly in current LLVM/Clang master (upcoming version 11), but wasn't with previous versions as pointless non-member-completions were returned. As our workaround is not applicable anymore with LLVM/Clang 10, disable the corresponding test for that version as we cannot do anything about it. Change-Id: Ia02696175d0d532e16bc16a1010821b4aed20f8b Reviewed-by: Christian Kandeler --- src/tools/clangbackend/source/codecompleter.cpp | 2 ++ tests/unit/unittest/codecompleter-test.cpp | 4 +++- tests/unit/unittest/conditionally-disabled-tests.h | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/tools/clangbackend/source/codecompleter.cpp b/src/tools/clangbackend/source/codecompleter.cpp index 91a9ad69ba2..ae49b650dd2 100644 --- a/src/tools/clangbackend/source/codecompleter.cpp +++ b/src/tools/clangbackend/source/codecompleter.cpp @@ -61,6 +61,8 @@ CodeCompletions toCodeCompletions(const UnsavedFile &unsavedFile, return codeCompletions; } +// CLANG-UPGRADE-CHECK: Remove this workaround once we require LLVM/Clang 11 as that version makes +// the workaround pointless. void filterUnknownContextResults(ClangCodeCompleteResults &results, const UnsavedFile &theUnsavedFile, uint line, diff --git a/tests/unit/unittest/codecompleter-test.cpp b/tests/unit/unittest/codecompleter-test.cpp index ec865aacbde..dcb1c1a57c9 100644 --- a/tests/unit/unittest/codecompleter-test.cpp +++ b/tests/unit/unittest/codecompleter-test.cpp @@ -530,7 +530,9 @@ TEST_F(CodeCompleterSlowTest, NoDotArrowCorrectionForColonColon) ASSERT_THAT(completions, Not(Contains(HasFixIts()))); } -TEST_F(CodeCompleterSlowTest, NoGlobalCompletionAfterForwardDeclaredClassPointer) +// Our workaround is not applicable with LLVM/Clang 10 anymore, so disable this test for that version. +// Luckily, the workaround is not needed anymore with LLVM/Clang 11. +TEST_F(CodeCompleterSlowTest, DISABLED_FOR_CLANG_10(NoGlobalCompletionAfterForwardDeclaredClassPointer)) { auto myCompleter = setupCompleter(globalCompletionAfterForwardDeclaredClassPointer); const ClangBackEnd::CodeCompletions completions = myCompleter.complete(5, 10); diff --git a/tests/unit/unittest/conditionally-disabled-tests.h b/tests/unit/unittest/conditionally-disabled-tests.h index 128520a8817..91b2541fe9d 100644 --- a/tests/unit/unittest/conditionally-disabled-tests.h +++ b/tests/unit/unittest/conditionally-disabled-tests.h @@ -25,6 +25,14 @@ #include +#include + +#if CINDEX_VERSION_MAJOR == 0 && CINDEX_VERSION_MINOR == 59 +# define DISABLED_FOR_CLANG_10(x) DISABLED_##x +#else +# define DISABLED_FOR_CLANG_10(x) x +#endif + #ifdef Q_OS_WIN # define DISABLED_ON_WINDOWS(x) DISABLED_##x #else