[PATCH] D52225: [clang] Implement Override Suggestions in Sema.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 1 05:22:26 PDT 2018


kadircet added inline comments.


================
Comment at: lib/Sema/SemaCodeComplete.cpp:1639
+        llvm::raw_string_ostream OS(OverrideSignature);
+        CodeCompletionResult CCR(Method, 0);
+        PrintingPolicy Policy =
----------------
ioeric wrote:
> kadircet wrote:
> > ioeric wrote:
> > > Could you add comments explaining what the following code does? The original code in clangd only has `Results.emplace_back(Method, 0);`, and it's non-trivial what the new code here is for.
> > Yeah you are right added some comments, previously this was handled on CodeCompletionBuilder in clangd which converted the completion item into a override declaration to be inserted.
> Thanks! Could you elaborate on why you need to explicitly handle `CCR` and `CCS`, i.e. why was `Results.emplace_back(Method, 0);` not enough? I guess it's to avoid inserting return type when it's already typed, but it's not obvious from the code.
Actually it is to generate a new CodeCompletionString with a single TypedText chunk that will include all of the declaration. Since you need to type whole declaration, which is also the part that has been used to filter completion candidates based on completion token.

It also helped me notice a bug relating optional params, I wasn't putting them into the typedtext chunk whereas I should've, fixed that one also.


Repository:
  rC Clang

https://reviews.llvm.org/D52225





More information about the cfe-commits mailing list