sammccall added inline comments.

Comment at: clang/include/clang/Sema/Sema.h:11968
                                     bool AfterAmpersand);
+  void CodeCompleteFunctionDeleteAndDefaultSpecifier();
nit: "specifier" isn't an accurate term here. I don't know that there is one, 
and it seems better to name the method after the situation rather than the 
concrete completions it might offer.

Maybe just CodeCompleteAfterFunctionEquals?

Comment at: clang/lib/Sema/SemaCodeComplete.cpp:6274
+  // special functions.
+  Results.AddResult("default");
+  // FIXME(liuhui): Ideally, we should only provide `delete` completion for the
I'm not sure offering default whether it's valid or not is an improvement over 
never offering it.

I think the following checks are easy to implement based on the `Declarator` 
and "good enough":
 - offered for destructors
 - offered for operator= (regardless of signature)
 - offered for constructors with 0 or 1 arguments (regardless of type)
 - optional: offered for operator<, operator>, operator==, operator<=> (if 
C++20 is enabled, even if this is not a member function!)

In particular, we shouldn't offer =default for arbitrary methods (consider `= 
0` on a virtual method), and we shouldn't offer it for non-members (I think 
currently it will be offered outside class context)

  rG LLVM Github Monorepo


cfe-commits mailing list

Reply via email to