ClangCodeModel: Show only valid applicable overloads when completing

libclang is smart enough to filter the overloads according to which
arguments have already been entered, so let's make use of that.

Fixes: QTCREATORBUG-650
Change-Id: Ic2711f460c908c6fd9c8efe28c3c63a0ce2d9205
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-02-12 11:36:17 +01:00
committed by Christian Stenger
parent 9c9ca280ea
commit dfa24f09ad
7 changed files with 38 additions and 8 deletions

View File

@@ -261,14 +261,14 @@ TEST_F(ClangCompletionContextAnalyzer, ArgumentTwoAtCall)
{
auto analyzer = runAnalyzer("f(1,@");
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClangAfterLeftParen, -2, -2, positionInText, false));
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClangAfterLeftParen, 0, -2, positionInText, false));
}
TEST_F(ClangCompletionContextAnalyzer, ArgumentTwoWithSpaceAtCall)
{
auto analyzer = runAnalyzer("f(1, @");
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClangAfterLeftParen, -3, -3, positionInText, false));
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClangAfterLeftParen, 0, -3, positionInText, false));
}
TEST_F(ClangCompletionContextAnalyzer, WhitespaceAfterFunctionName)
@@ -289,7 +289,7 @@ TEST_F(ClangCompletionContextAnalyzer, ArgumentTwoWithSpaceAtConstructorCallWith
{
auto analyzer = runAnalyzer("f{1, @");
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClangAfterLeftParen, -3, -3, positionInText, false));
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClangAfterLeftParen, 0, -3, positionInText, false));
}
TEST_F(ClangCompletionContextAnalyzer, WhitespaceBeforeConstructorCallWithBraceInitializer)
@@ -546,7 +546,7 @@ TEST_F(ClangCompletionContextAnalyzer, TemplatedFunctionSecondArgument)
{
auto analyzer = runAnalyzer("f < decltype(bar -> member) > (1, @");
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClangAfterLeftParen, -3, -3, positionInText, false));
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClangAfterLeftParen, 0, -3, positionInText, false));
}
TEST_F(ClangCompletionContextAnalyzer, FunctionNameStartPosition)