[PATCH] D62298: [CodeComplete] Filter override completions by function name

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 23 06:19:49 PDT 2019


kadircet added inline comments.


================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:3154
+/// The result contains only 'typed text' and 'text' chunks.
+static void PrintOverrideString(const CodeCompletionString &CCS,
+                                CodeCompletionBuilder &Result) {
----------------
change name to `printOverrideString`


================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:3166
+    // Add a space after return type.
+    if (Chunk.Kind == CodeCompletionString::CK_ResultType)
+      Result.AddChunk(CodeCompletionString::CK_HorizontalSpace);
----------------
I believe it is sensible to make resulttype a typed text as well, because people might start typing the function signature instead of name if they are not familiar with the feature


================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:3182
+  Result.AddChunk(CodeCompletionString::CK_HorizontalSpace);
+  Result.AddTextChunk("override");
   return Result.TakeString();
----------------
I believe we should  make `override` a typed text as well.


================
Comment at: clang/test/CodeCompletion/overrides.cpp:23
 //
-// Runs completion at vo^id.
-// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:5 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: COMPLETION: Pattern : void vfunc(bool param, int p) override{{$}}
+// Runs completion at v^oid.
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:4 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
----------------
either restore this to original version(if we decide to make return type a typed_text as well) or get rid of the void keyword completely and only keep `v`? because at first sight it looks like we are triggering on return type :D


================
Comment at: clang/test/CodeCompletion/overrides.cpp:26
 // CHECK-CC2-NOT: COMPLETION: Pattern : int ttt(bool param, int x = 3) const override{{$}}
+// CHECK-CC2: COMPLETION: Pattern : void vfunc(bool param, int p) override{{$}}
 // CHECK-CC2-NOT: COMPLETION: Pattern : void vfunc(bool param) override{{$}}
----------------
why move this ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62298/new/

https://reviews.llvm.org/D62298





More information about the cfe-commits mailing list