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 <christian.kandeler@qt.io>
This commit is contained in:
Nikolai Kosjar
2020-05-22 09:05:00 +02:00
parent 82be99a53e
commit 8df8502090
3 changed files with 13 additions and 1 deletions

View File

@@ -61,6 +61,8 @@ CodeCompletions toCodeCompletions(const UnsavedFile &unsavedFile,
return codeCompletions; 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, void filterUnknownContextResults(ClangCodeCompleteResults &results,
const UnsavedFile &theUnsavedFile, const UnsavedFile &theUnsavedFile,
uint line, uint line,

View File

@@ -530,7 +530,9 @@ TEST_F(CodeCompleterSlowTest, NoDotArrowCorrectionForColonColon)
ASSERT_THAT(completions, Not(Contains(HasFixIts()))); 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); auto myCompleter = setupCompleter(globalCompletionAfterForwardDeclaredClassPointer);
const ClangBackEnd::CodeCompletions completions = myCompleter.complete(5, 10); const ClangBackEnd::CodeCompletions completions = myCompleter.complete(5, 10);

View File

@@ -25,6 +25,14 @@
#include <QtGlobal> #include <QtGlobal>
#include <clang-c/Index.h>
#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 #ifdef Q_OS_WIN
# define DISABLED_ON_WINDOWS(x) DISABLED_##x # define DISABLED_ON_WINDOWS(x) DISABLED_##x
#else #else