aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/libclang/CIndexCodeCompletion.cpp
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2021-12-27 20:42:11 +0100
committerSam McCall <sam.mccall@gmail.com>2022-01-03 20:14:59 +0100
commit92417eaf3329dc823c905ec6a608b83ac62b4f7c (patch)
treebcfd0d918088aaddee36fe7a53b37d3a1f49e017 /clang/tools/libclang/CIndexCodeCompletion.cpp
parenta390c9905d4d1e7a7437fc1ab57f720c06618d79 (diff)
downloadllvm-92417eaf3329dc823c905ec6a608b83ac62b4f7c.zip
llvm-92417eaf3329dc823c905ec6a608b83ac62b4f7c.tar.gz
llvm-92417eaf3329dc823c905ec6a608b83ac62b4f7c.tar.bz2
[CodeCompletion] Signature help for braced constructor calls
Implementation is based on the "expected type" as used for designated-initializers in braced init lists. This means it can deduce the type in some cases where it's not written: void foo(Widget); foo({ /*help here*/ }); Only basic constructor calls are in scope of this patch, excluded are: - aggregate initialization (no help is offered for aggregates) - initializer_list initialization (no help is offered for these constructors) Fixes https://github.com/clangd/clangd/issues/306 Differential Revision: https://reviews.llvm.org/D116317
Diffstat (limited to 'clang/tools/libclang/CIndexCodeCompletion.cpp')
-rw-r--r--clang/tools/libclang/CIndexCodeCompletion.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/tools/libclang/CIndexCodeCompletion.cpp b/clang/tools/libclang/CIndexCodeCompletion.cpp
index 044cac9..0d75970 100644
--- a/clang/tools/libclang/CIndexCodeCompletion.cpp
+++ b/clang/tools/libclang/CIndexCodeCompletion.cpp
@@ -656,14 +656,15 @@ namespace {
void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg,
OverloadCandidate *Candidates,
unsigned NumCandidates,
- SourceLocation OpenParLoc) override {
+ SourceLocation OpenParLoc,
+ bool Braced) override {
StoredResults.reserve(StoredResults.size() + NumCandidates);
for (unsigned I = 0; I != NumCandidates; ++I) {
- CodeCompletionString *StoredCompletion
- = Candidates[I].CreateSignatureString(CurrentArg, S, getAllocator(),
+ CodeCompletionString *StoredCompletion =
+ Candidates[I].CreateSignatureString(CurrentArg, S, getAllocator(),
getCodeCompletionTUInfo(),
- includeBriefComments());
-
+ includeBriefComments(), Braced);
+
CXCompletionResult R;
R.CursorKind = CXCursor_OverloadCandidate;
R.CompletionString = StoredCompletion;