[Lldb-commits] [PATCH] D116317: [CodeCompletion] Signature help for braced constructor calls
sammccall updated this revision to Diff 396324. sammccall added a comment. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. Fix lldb build Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116317/new/ https://reviews.llvm.org/D116317 Files: clang-tools-extra/clangd/ClangdLSPServer.cpp clang-tools-extra/clangd/CodeComplete.cpp clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp clang/include/clang/Sema/CodeCompleteConsumer.h clang/include/clang/Sema/Sema.h clang/lib/Frontend/ASTUnit.cpp clang/lib/Parse/ParseDecl.cpp clang/lib/Parse/ParseDeclCXX.cpp clang/lib/Parse/ParseExprCXX.cpp clang/lib/Parse/ParseInit.cpp clang/lib/Parse/ParseOpenMP.cpp clang/lib/Sema/CodeCompleteConsumer.cpp clang/lib/Sema/SemaCodeComplete.cpp clang/test/CodeCompletion/ctor-signature.cpp clang/tools/libclang/CIndexCodeCompletion.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp === --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -995,7 +995,8 @@ void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, - SourceLocation OpenParLoc) override { + SourceLocation OpenParLoc, + bool Braced) override { // At the moment we don't filter out any overloaded candidates. } Index: clang/tools/libclang/CIndexCodeCompletion.cpp === --- clang/tools/libclang/CIndexCodeCompletion.cpp +++ clang/tools/libclang/CIndexCodeCompletion.cpp @@ -656,14 +656,15 @@ 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; Index: clang/test/CodeCompletion/ctor-signature.cpp === --- clang/test/CodeCompletion/ctor-signature.cpp +++ clang/test/CodeCompletion/ctor-signature.cpp @@ -15,3 +15,40 @@ // CHECK-CC2: OVERLOAD: Foo(<#const Foo >) // CHECK-CC2: OVERLOAD: Foo(<#Foo &> } + +namespace std { +template struct initializer_list {}; +} // namespace std + +struct Bar { + // CHECK-BRACED: OVERLOAD: Bar{<#int#>} + Bar(int); + // CHECK-BRACED: OVERLOAD: Bar{<#double#>, double} + Bar(double, double); + // FIXME: no support for init-list constructors yet. + // CHECK-BRACED-NOT: OVERLOAD: {{.*}}char + Bar(std::initializer_list C); + // CHECK-BRACED: OVERLOAD: Bar{<#const Bar >} + // CHECK-BRACED: OVERLOAD: Bar{<#T *Pointer#>} + template Bar(T *Pointer); +}; + +auto b1 = Bar{}; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:36:15 %s | FileCheck -check-prefix=CHECK-BRACED %s +Bar b2{}; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:38:8 %s | FileCheck -check-prefix=CHECK-BRACED %s +static int consumeBar(Bar) { return 0; } +int b3 = consumeBar({}); +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:41:22 %s | FileCheck -check-prefix=CHECK-BRACED %s + +struct Aggregate { + // FIXME: no support for aggregates yet. + // CHECK-AGGREGATE-NOT: OVERLOAD: Aggregate{<#const Aggregate >} + // CHECK-AGGREGATE-NOT: OVERLOAD: {{.*}}first + int first; + int second; +}; + +Aggregate a{}; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:52:13 %s | FileCheck -check-prefix=CHECK-AGGREGATE %s + Index: clang/lib/Sema/SemaCodeComplete.cpp === --- clang/lib/Sema/SemaCodeComplete.cpp +++ clang/lib/Sema/SemaCodeComplete.cpp @@ -3761,7 +3761,8 @@ CodeCompletionString * CodeCompleteConsu
[Lldb-commits] [PATCH] D116317: [CodeCompletion] Signature help for braced constructor calls
sammccall updated this revision to Diff 396325. sammccall edited the summary of this revision. sammccall added a comment. Herald added subscribers: JDevlieghere, ilya-biryukov. Revert some unintended changes, clean up tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116317/new/ https://reviews.llvm.org/D116317 Files: clang-tools-extra/clangd/ClangdLSPServer.cpp clang-tools-extra/clangd/CodeComplete.cpp clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp clang/include/clang/Sema/CodeCompleteConsumer.h clang/include/clang/Sema/Sema.h clang/lib/Frontend/ASTUnit.cpp clang/lib/Parse/ParseDecl.cpp clang/lib/Parse/ParseDeclCXX.cpp clang/lib/Parse/ParseExprCXX.cpp clang/lib/Parse/ParseInit.cpp clang/lib/Parse/ParseOpenMP.cpp clang/lib/Sema/CodeCompleteConsumer.cpp clang/lib/Sema/SemaCodeComplete.cpp clang/test/CodeCompletion/ctor-signature.cpp clang/tools/libclang/CIndexCodeCompletion.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp === --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -995,7 +995,8 @@ void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, - SourceLocation OpenParLoc) override { + SourceLocation OpenParLoc, + bool Braced) override { // At the moment we don't filter out any overloaded candidates. } Index: clang/tools/libclang/CIndexCodeCompletion.cpp === --- clang/tools/libclang/CIndexCodeCompletion.cpp +++ clang/tools/libclang/CIndexCodeCompletion.cpp @@ -656,14 +656,15 @@ 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; Index: clang/test/CodeCompletion/ctor-signature.cpp === --- clang/test/CodeCompletion/ctor-signature.cpp +++ clang/test/CodeCompletion/ctor-signature.cpp @@ -15,3 +15,40 @@ // CHECK-CC2: OVERLOAD: Foo(<#const Foo >) // CHECK-CC2: OVERLOAD: Foo(<#Foo &> } + +namespace std { +template struct initializer_list {}; +} // namespace std + +struct Bar { + // CHECK-BRACED: OVERLOAD: Bar{<#int#>} + Bar(int); + // CHECK-BRACED: OVERLOAD: Bar{<#double#>, double} + Bar(double, double); + // FIXME: no support for init-list constructors yet. + // CHECK-BRACED-NOT: OVERLOAD: {{.*}}char + Bar(std::initializer_list C); + // CHECK-BRACED: OVERLOAD: Bar{<#const Bar >} + // CHECK-BRACED: OVERLOAD: Bar{<#T *Pointer#>} + template Bar(T *Pointer); +}; + +auto b1 = Bar{}; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:36:15 %s | FileCheck -check-prefix=CHECK-BRACED %s +Bar b2{}; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:38:8 %s | FileCheck -check-prefix=CHECK-BRACED %s +static int consumeBar(Bar) { return 0; } +int b3 = consumeBar({}); +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:41:22 %s | FileCheck -check-prefix=CHECK-BRACED %s + +struct Aggregate { + // FIXME: no support for aggregates yet. + // CHECK-AGGREGATE-NOT: OVERLOAD: Aggregate{<#const Aggregate >} + // CHECK-AGGREGATE-NOT: OVERLOAD: {{.*}}first + int first; + int second; +}; + +Aggregate a{}; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:52:13 %s | FileCheck -check-prefix=CHECK-AGGREGATE %s + Index: clang/lib/Sema/SemaCodeComplete.cpp === --- clang/lib/Sema/SemaCodeComplete.cpp +++ clang/lib/Sema/SemaCodeComplete.cpp
[Lldb-commits] [PATCH] D116317: [CodeCompletion] Signature help for braced constructor calls
sammccall updated this revision to Diff 396362. sammccall added a comment. Fix clangd tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116317/new/ https://reviews.llvm.org/D116317 Files: clang-tools-extra/clangd/ClangdLSPServer.cpp clang-tools-extra/clangd/CodeComplete.cpp clang-tools-extra/clangd/test/initialize-params.test clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp clang/include/clang/Sema/CodeCompleteConsumer.h clang/include/clang/Sema/Sema.h clang/lib/Frontend/ASTUnit.cpp clang/lib/Parse/ParseDecl.cpp clang/lib/Parse/ParseDeclCXX.cpp clang/lib/Parse/ParseExprCXX.cpp clang/lib/Parse/ParseInit.cpp clang/lib/Parse/ParseOpenMP.cpp clang/lib/Sema/CodeCompleteConsumer.cpp clang/lib/Sema/SemaCodeComplete.cpp clang/test/CodeCompletion/ctor-signature.cpp clang/tools/libclang/CIndexCodeCompletion.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp === --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -995,7 +995,8 @@ void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, - SourceLocation OpenParLoc) override { + SourceLocation OpenParLoc, + bool Braced) override { // At the moment we don't filter out any overloaded candidates. } Index: clang/tools/libclang/CIndexCodeCompletion.cpp === --- clang/tools/libclang/CIndexCodeCompletion.cpp +++ clang/tools/libclang/CIndexCodeCompletion.cpp @@ -656,14 +656,15 @@ 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; Index: clang/test/CodeCompletion/ctor-signature.cpp === --- clang/test/CodeCompletion/ctor-signature.cpp +++ clang/test/CodeCompletion/ctor-signature.cpp @@ -15,3 +15,40 @@ // CHECK-CC2: OVERLOAD: Foo(<#const Foo >) // CHECK-CC2: OVERLOAD: Foo(<#Foo &> } + +namespace std { +template struct initializer_list {}; +} // namespace std + +struct Bar { + // CHECK-BRACED: OVERLOAD: Bar{<#int#>} + Bar(int); + // CHECK-BRACED: OVERLOAD: Bar{<#double#>, double} + Bar(double, double); + // FIXME: no support for init-list constructors yet. + // CHECK-BRACED-NOT: OVERLOAD: {{.*}}char + Bar(std::initializer_list C); + // CHECK-BRACED: OVERLOAD: Bar{<#const Bar >} + // CHECK-BRACED: OVERLOAD: Bar{<#T *Pointer#>} + template Bar(T *Pointer); +}; + +auto b1 = Bar{}; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:36:15 %s | FileCheck -check-prefix=CHECK-BRACED %s +Bar b2{}; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:38:8 %s | FileCheck -check-prefix=CHECK-BRACED %s +static int consumeBar(Bar) { return 0; } +int b3 = consumeBar({}); +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:41:22 %s | FileCheck -check-prefix=CHECK-BRACED %s + +struct Aggregate { + // FIXME: no support for aggregates yet. + // CHECK-AGGREGATE-NOT: OVERLOAD: Aggregate{<#const Aggregate >} + // CHECK-AGGREGATE-NOT: OVERLOAD: {{.*}}first + int first; + int second; +}; + +Aggregate a{}; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:52:13 %s | FileCheck -check-prefix=CHECK-AGGREGATE %s + Index: clang/lib/Sema/SemaCodeComplete.cpp === --- clang/lib/Sema/SemaCodeComplete.cpp +++ clang/lib/Sema/SemaCodeComplete.cpp @@ -3761,7 +3761,8 @@ CodeCompletionString * CodeCompleteConsumer::Overload