[PATCH] D53191: [clang] Use Statement and Namespace instead of Name and PotentiallyQualifiedName

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 12 05:09:44 PDT 2018


kadircet updated this revision to Diff 169374.
kadircet added a comment.

- Use statement as context for using decls.


Repository:
  rC Clang

https://reviews.llvm.org/D53191

Files:
  lib/Sema/SemaCodeComplete.cpp
  test/CodeCompletion/ordinary-name.c


Index: test/CodeCompletion/ordinary-name.c
===================================================================
--- test/CodeCompletion/ordinary-name.c
+++ test/CodeCompletion/ordinary-name.c
@@ -3,8 +3,9 @@
 typedef struct t TYPEDEF;
 typedef struct t _TYPEDEF;
 void foo() {
+  int yar;
   int y;
-  // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+  // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
   // CHECK-CC1-NOT: __INTEGER_TYPE
   // CHECK-CC1: _Imaginary
   // CHECK-CC1: _MyPrivateType
@@ -16,3 +17,6 @@
 
   // PR8744
   // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:1:11 %s
+
+  // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:7:8 %s -o - | FileCheck -allow-empty %s
+  // CHECK-NOT: yar
Index: lib/Sema/SemaCodeComplete.cpp
===================================================================
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -4822,7 +4822,7 @@
   // it can be useful for global code completion which have information about
   // contexts/symbols that are not in the AST.
   if (SS.isInvalid()) {
-    CodeCompletionContext CC(CodeCompletionContext::CCC_Name);
+    CodeCompletionContext CC(CodeCompletionContext::CCC_Statement);
     CC.setCXXScopeSpecifier(SS);
     HandleCodeCompleteResults(this, CodeCompleter, CC, nullptr, 0);
     return;
@@ -4840,7 +4840,7 @@
 
   ResultBuilder Results(*this, CodeCompleter->getAllocator(),
                         CodeCompleter->getCodeCompletionTUInfo(),
-                        CodeCompletionContext::CCC_Name);
+                        CodeCompletionContext::CCC_Statement);
   Results.EnterNewScope();
 
   // The "template" keyword can follow "::" in the grammar, but only
@@ -4880,7 +4880,7 @@
 
   ResultBuilder Results(*this, CodeCompleter->getAllocator(),
                         CodeCompleter->getCodeCompletionTUInfo(),
-                        CodeCompletionContext::CCC_PotentiallyQualifiedName,
+                        CodeCompletionContext::CCC_Statement,
                         &ResultBuilder::IsNestedNameSpecifier);
   Results.EnterNewScope();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53191.169374.patch
Type: text/x-patch
Size: 2276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181012/184364e0/attachment.bin>


More information about the cfe-commits mailing list