CppTools: Highlight type for templated using

Task-number: QTCREATORBUG-9944
Change-Id: I614571e05039f24b7d56abdddc15f912581f68f1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-05-26 23:30:02 +03:00
committed by Orgad Shaneh
parent d004b1b616
commit 588b333669
2 changed files with 11 additions and 2 deletions

View File

@@ -1183,8 +1183,9 @@ bool CheckSymbols::isTemplateClass(Symbol *symbol) const
if (symbol) {
if (Template *templ = symbol->asTemplate()) {
if (Symbol *declaration = templ->declaration()) {
if (declaration->isClass() || declaration->isForwardClassDeclaration())
return true;
return declaration->isClass()
|| declaration->isForwardClassDeclaration()
|| declaration->isTypedef();
}
}
}

View File

@@ -994,6 +994,14 @@ void tst_CheckSymbols::test_checksymbols_data()
<< Use(10, 13, 3, Highlighting::LocalUse)
);
QTest::newRow("template_alias")
<< _("template<class T>\n"
"using Foo = Bar;\n")
<< (QList<Use>()
<< Use(1, 16, 1, Highlighting::TypeUse)
<< Use(2, 7, 3, Highlighting::TypeUse)
);
QTest::newRow("using_inside_different_namespace_QTCREATORBUG7978")
<< _("class My" TEST_UNICODE_IDENTIFIER "Type { int " TEST_UNICODE_IDENTIFIER "Member; };\n"
"void f(My" TEST_UNICODE_IDENTIFIER "Type var" TEST_UNICODE_IDENTIFIER ")\n"