From: Hans Wennborg Date: Mon, 22 Jul 2019 18:12:26 +0000 (+0000) Subject: Merging r366448 and r366457: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=208e849f284628e278de5dc9c41ba117376b6bf9;p=clang Merging r366448 and r366457: ------------------------------------------------------------------------ r366448 | ibiryukov | 2019-07-18 17:21:34 +0200 (Thu, 18 Jul 2019) | 24 lines [ASTUnit] Fix a regression in cached completions Summary: After r345152 cached completions started adding namespaces after nested name specifiers, e.g. in `some_name::^` The CCC_Symbol indicates the completed item cannot be a namespace (it is described as being "a type, a function or a variable" in the comments). Therefore, 'nested specifier' completions should only be added from cache when the context is CCC_SymbolOrNewName (which roughly seems to indicate that a nested name specifier is allowed). Fixes https://bugs.llvm.org/show_bug.cgi?id=42646 Reviewers: kadircet, sammccall Reviewed By: kadircet, sammccall Subscribers: arphaman, nik, sammccall, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64918 ------------------------------------------------------------------------ ------------------------------------------------------------------------ r366457 | ibiryukov | 2019-07-18 18:24:09 +0200 (Thu, 18 Jul 2019) | 1 line [ASTUnit] Attempt to unbreak Windows buildbots after r366448 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_90@366717 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 7445a94cfe..783d1f9d09 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -435,7 +435,6 @@ void ASTUnit::CacheCodeCompletionResults() { | (1LL << CodeCompletionContext::CCC_UnionTag) | (1LL << CodeCompletionContext::CCC_ClassOrStructTag) | (1LL << CodeCompletionContext::CCC_Type) - | (1LL << CodeCompletionContext::CCC_Symbol) | (1LL << CodeCompletionContext::CCC_SymbolOrNewName) | (1LL << CodeCompletionContext::CCC_ParenthesizedExpression); diff --git a/test/Index/complete-qualified-cached.cpp b/test/Index/complete-qualified-cached.cpp new file mode 100644 index 0000000000..b866abec90 --- /dev/null +++ b/test/Index/complete-qualified-cached.cpp @@ -0,0 +1,22 @@ +namespace a_namespace {}; +class Class { static void foo(); }; +Class:: +// Completion for a_namespace should be available at the start of the line. +// START-OF-LINE: a_namespace +// START-OF-LINE: Class +// -- Using cached completions. +// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:3:1 %s \ +// RUN: | FileCheck --check-prefix=START-OF-LINE %s +// -- Without cached completions. +// RUN: c-index-test -code-completion-at=%s:3:1 %s \ +// RUN: | FileCheck --check-prefix=START-OF-LINE %s +// +// +// ... and should not be available after 'Class::^' +// AFTER-QUALIFIER: Class +// -- Using cached completions. +// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:3:8 %s \ +// RUN: | FileCheck --implicit-check-not=a_namespace --check-prefix=AFTER-QUALIFIER %s +// -- Without cached completions. +// RUN: c-index-test -code-completion-at=%s:3:8 %s \ +// RUN: | FileCheck --implicit-check-not=a_namespace --check-prefix=AFTER-QUALIFIER %s