[PATCH] Implementation for completion in call context for C++
Francisco Lopes da Silva
francisco.mailing.lists at oblita.com
Thu Jan 8 10:19:20 PST 2015
Hi klimek,
Improved completion in call context to work with C++'s templates, member functions, et al.
In important aspect of this implementation is that I've took freedom
to make fundamental changes to its previous completion behavior.
As can be seen, in lib/Sema/SemaCodeComplete.cpp this comment:
// When we're code-completing for a call, we fall back to ordinary
// name code-completion whenever we can't produce specific
// results. We may want to revisit this strategy in the future,
// e.g., by merging the two kinds of results.
was changed to this:
// When we're code-completing for a call, we DON'T fall back to ordinary
// name code-completion whenever we can't produce specific
// results. This will do "parameter completion" solely.
The rationale behind this change is:
- The former comment shows that completion in call context is still not
in a definite state, open to discussion.
- I firmly believe this new behavior is for good. In call context, 99% of
the time, code authoring tools will be interested in information about the
prototype and arguments solely, not in all possible kinds of expressions
that can fit as an argument. This behavior turns the interface slower than
necessary to have almost no benefit.
So I believe that completion in call context just after '(' and ',' should
work similarly as for member access: to only provide what's of interest,
which is parametric information (function prototypes, current argument,
parameter types, etc.).
Despite this, I should be able revert to the former behavior in the change set
without much trouble, in case there's no agreement on this, while still
providing the new set of completions.
http://reviews.llvm.org/D6880
Files:
include/clang/Sema/Sema.h
lib/Sema/SemaCodeComplete.cpp
lib/Sema/SemaOverload.cpp
lib/Sema/SemaTemplateDeduction.cpp
test/CodeCompletion/call.cpp
test/Index/complete-call.cpp
test/Index/complete-exprs.c
test/Index/complete-macros.c
test/Index/complete-type-factors.m
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6880.17901.patch
Type: text/x-patch
Size: 61345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150108/2ce669f6/attachment.bin>
More information about the cfe-commits
mailing list