C++: fix highlighting for template parameters for function calls.

Change-Id: Ie0133893d8b8d35ea2aa599cb8f7d5c2cc55271e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2013-04-12 13:45:02 +02:00
committed by Nikolai Kosjar
parent a0d6df7bd8
commit 3173f6fb3e
2 changed files with 32 additions and 0 deletions

View File

@@ -594,6 +594,8 @@ bool CheckSymbols::visit(CallAST *ast)
if (QualifiedNameAST *q = memberName->asQualifiedName()) {
checkNestedName(q);
memberName = q->unqualified_name;
} else if (TemplateIdAST *tId = memberName->asTemplateId()) {
accept(tId->template_argument_list);
}
if (!maybeAddFunction(candidates, memberName, argumentCount)
@@ -611,6 +613,8 @@ bool CheckSymbols::visit(CallAST *ast)
if (QualifiedNameAST *q = exprName->asQualifiedName()) {
checkNestedName(q);
exprName = q->unqualified_name;
} else if (TemplateIdAST *tId = exprName->asTemplateId()) {
accept(tId->template_argument_list);
}
const QList<LookupItem> candidates =

View File

@@ -184,6 +184,7 @@ private slots:
void test_checksymbols_QTCREATORBUG8890_danglingPointer();
void test_checksymbols_QTCREATORBUG8974_danglingPointer();
void operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006();
void test_checksymbols_templated_functions();
};
void tst_CheckSymbols::test_checksymbols_TypeUse()
@@ -1387,7 +1388,34 @@ void tst_CheckSymbols::operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG
;
TestData::check(source, expectedUses);
}
void tst_CheckSymbols::test_checksymbols_templated_functions()
{
const QByteArray source =
"struct D {};\n" // line 1
"struct A {\n" // line 2
" template<typename T> int B();\n" // line 3
" void C() {\n" // line 4
" B<D>();\n" // line 5
" this->B<D>();\n" // line 6
" }\n" // line 7
"};\n" // line 8
;
const QList<Use> expectedUses = QList<Use>()
<< Use(1, 8, 1, SemanticInfo::TypeUse)
<< Use(2, 8, 1, SemanticInfo::TypeUse)
<< Use(3, 23, 1, SemanticInfo::TypeUse)
<< Use(3, 30, 1, SemanticInfo::FunctionUse)
<< Use(4, 10, 1, SemanticInfo::FunctionUse)
<< Use(5, 9, 1, SemanticInfo::FunctionUse)
<< Use(5, 11, 1, SemanticInfo::TypeUse)
<< Use(6, 15, 1, SemanticInfo::FunctionUse)
<< Use(6, 17, 1, SemanticInfo::TypeUse)
;
TestData::check(source, expectedUses);
}
QTEST_APPLESS_MAIN(tst_CheckSymbols)