[CodeComplete] Member completion for concept-constrained types.
authorSam McCall <sam.mccall@gmail.com>
Wed, 29 Jan 2020 18:11:21 +0000 (19:11 +0100)
committerSam McCall <sam.mccall@gmail.com>
Tue, 31 Mar 2020 16:43:24 +0000 (18:43 +0200)
commita76e68c9704fb5b3faf25bb8d51e405b5310ff08
tree739cb8886ac3e8773794fd0e35bf62d96bb5336c
parent41c135d6d2882ee6592a1c51a0221ef6def79ee4
[CodeComplete] Member completion for concept-constrained types.

Summary:
The basic idea is to walk through the concept definition, looking for
t.foo() where t has the constrained type.

In this patch:
 - nested types are recognized and offered after ::
 - variable/function members are recognized and offered after the correct
   dot/arrow/colon trigger
 - member functions are recognized (anything directly called). parameter
   types are presumed to be the argument types. parameters are unnamed.
 - result types are available when a requirement has a type constraint.
   These are printed as constraints, except same_as<T> which prints as T.

Not in this patch:
 - support for merging/overloading when two locations describe the same member.
   The last one wins, for any given name. This is probably important...
 - support for nested template members (T::x<int>)
 - support for completing members of (instantiations of) template template parameters

Reviewers: nridge, saar.raz

Subscribers: mgrang, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73649
clang/include/clang/Sema/Scope.h
clang/lib/Sema/CodeCompleteConsumer.cpp
clang/lib/Sema/SemaCodeComplete.cpp
clang/test/CodeCompletion/concepts.cpp [new file with mode: 0644]