diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2015-10-25 23:31:20 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2016-06-20 10:55:31 +0000 |
commit | 246e72262c4812a82a5e7d5289f7a2308a9ace43 (patch) | |
tree | da14953f00075da8ada1e284267e7ae286ba0266 | |
parent | 72e6dd2ab102ddb45ab3de12f61ab1d21c41e6eb (diff) | |
download | qt-creator-246e72262c4812a82a5e7d5289f7a2308a9ace43.tar.gz |
CppTools: Separate highlighting for function declarations and calls
Task-number: QTCREATORBUG-15564
Change-Id: Iab1b60e19448202432f98295c89769cd376aa03f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
-rw-r--r-- | src/plugins/cpptools/cppchecksymbols.cpp | 60 | ||||
-rw-r--r-- | src/plugins/cpptools/cppchecksymbols.h | 9 | ||||
-rw-r--r-- | src/plugins/cpptools/semantichighlighter.cpp | 12 | ||||
-rw-r--r-- | src/plugins/cpptools/semantichighlighter.h | 4 | ||||
-rw-r--r-- | tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp | 133 |
5 files changed, 129 insertions, 89 deletions
diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp index 5d82cc7f97..8859aef78e 100644 --- a/src/plugins/cpptools/cppchecksymbols.cpp +++ b/src/plugins/cpptools/cppchecksymbols.cpp @@ -517,15 +517,16 @@ bool CheckSymbols::visit(SimpleDeclarationAST *ast) if (funTy->isVirtual() || (nameAST->asDestructorName() && hasVirtualDestructor(_context.lookupType(funTy->enclosingScope())))) { - addUse(nameAST, SemanticHighlighter::VirtualMethodUse); + addUse(nameAST, SemanticHighlighter::VirtualFunctionDeclarationUse); declrIdNameAST = nameAST; } else if (maybeAddFunction(_context.lookup(decl->name(), decl->enclosingScope()), - nameAST, funTy->argumentCount())) { + nameAST, funTy->argumentCount(), + FunctionDeclaration)) { declrIdNameAST = nameAST; // Add a diagnostic message if non-virtual function has override/final marker - if ((_usages.back().kind != SemanticHighlighter::VirtualMethodUse)) { + if ((_usages.back().kind != SemanticHighlighter::VirtualFunctionDeclarationUse)) { if (funTy->isOverride()) warning(declrIdNameAST, QCoreApplication::translate( "CPlusplus::CheckSymbols", "Only virtual functions can be marked 'override'")); @@ -618,7 +619,7 @@ bool CheckSymbols::visit(CallAST *ast) accept(tId->template_argument_list); } - if (!maybeAddFunction(candidates, memberName, argumentCount) + if (!maybeAddFunction(candidates, memberName, argumentCount, FunctionCall) && highlightCtorDtorAsType) { expr = ast->base_expression; } @@ -641,7 +642,7 @@ bool CheckSymbols::visit(CallAST *ast) typeOfExpression(textOf(idExpr), enclosingScope(), TypeOfExpression::Preprocess); - if (!maybeAddFunction(candidates, exprName, argumentCount) + if (!maybeAddFunction(candidates, exprName, argumentCount, FunctionCall) && highlightCtorDtorAsType) { expr = ast->base_expression; } @@ -704,7 +705,8 @@ bool CheckSymbols::visit(NewExpressionAST *ast) } } - maybeAddFunction(_context.lookup(nameAST->name, scope), nameAST, arguments); + maybeAddFunction(_context.lookup(nameAST->name, scope), nameAST, arguments, + FunctionCall); } } @@ -800,7 +802,7 @@ void CheckSymbols::checkName(NameAST *ast, Scope *scope) if (klass) { if (hasVirtualDestructor(_context.lookupType(klass))) { - addUse(ast, SemanticHighlighter::VirtualMethodUse); + addUse(ast, SemanticHighlighter::VirtualFunctionDeclarationUse); } else { bool added = false; if (highlightCtorDtorAsType && maybeType(ast->name)) @@ -857,7 +859,7 @@ bool CheckSymbols::visit(QualifiedNameAST *ast) if (binding && ast->unqualified_name) { if (ast->unqualified_name->asDestructorName() != 0) { if (hasVirtualDestructor(binding)) { - addUse(ast->unqualified_name, SemanticHighlighter::VirtualMethodUse); + addUse(ast->unqualified_name, SemanticHighlighter::VirtualFunctionDeclarationUse); } else { bool added = false; if (highlightCtorDtorAsType && maybeType(ast->name)) @@ -974,7 +976,8 @@ bool CheckSymbols::visit(MemInitializerAST *ast) for (ExpressionListAST *it = expr_list; it; it = it->next) ++arguments; } - maybeAddFunction(_context.lookup(nameAST->name, klass), nameAST, arguments); + maybeAddFunction(_context.lookup(nameAST->name, klass), + nameAST, arguments, FunctionCall); } break; @@ -1057,10 +1060,9 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast) if (fun->isVirtual() || (declId->asDestructorName() && hasVirtualDestructor(_context.lookupType(fun->enclosingScope())))) { - addUse(declId, SemanticHighlighter::VirtualMethodUse); - } else if (!maybeAddFunction(_context.lookup(fun->name(), - fun->enclosingScope()), - declId, fun->argumentCount())) { + addUse(declId, SemanticHighlighter::VirtualFunctionDeclarationUse); + } else if (!maybeAddFunction(_context.lookup(fun->name(), fun->enclosingScope()), + declId, fun->argumentCount(), FunctionDeclaration)) { processEntireDeclr = true; } } @@ -1259,7 +1261,8 @@ bool CheckSymbols::maybeAddField(const QList<LookupItem> &candidates, NameAST *a return false; } -bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST *ast, unsigned argumentCount) +bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST *ast, + unsigned argumentCount, FunctionKind functionKind) { unsigned startToken = ast->firstToken(); bool isDestructor = false; @@ -1275,7 +1278,9 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST return false; enum { Match_None, Match_TooManyArgs, Match_TooFewArgs, Match_Ok } matchType = Match_None; - Kind kind = SemanticHighlighter::FunctionUse; + + Kind kind = functionKind == FunctionDeclaration ? SemanticHighlighter::FunctionDeclarationUse + : SemanticHighlighter::FunctionUse; foreach (const LookupItem &r, candidates) { Symbol *c = r.declaration(); @@ -1300,24 +1305,31 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST if (!funTy || funTy->isAmbiguous()) continue; // TODO: add diagnostic messages and color call-operators calls too? + const bool isVirtual = funTy->isVirtual(); + Kind matchingKind; + if (functionKind == FunctionDeclaration) { + matchingKind = isVirtual ? SemanticHighlighter::VirtualFunctionDeclarationUse + : SemanticHighlighter::FunctionDeclarationUse; + } else { + matchingKind = isVirtual ? SemanticHighlighter::VirtualMethodUse + : SemanticHighlighter::FunctionUse; + } if (argumentCount < funTy->minimumArgumentCount()) { if (matchType != Match_Ok) { - kind = funTy->isVirtual() ? SemanticHighlighter::VirtualMethodUse : SemanticHighlighter::FunctionUse; + kind = matchingKind; matchType = Match_TooFewArgs; } } else if (argumentCount > funTy->argumentCount() && !funTy->isVariadic()) { if (matchType != Match_Ok) { matchType = Match_TooManyArgs; - kind = funTy->isVirtual() ? SemanticHighlighter::VirtualMethodUse : SemanticHighlighter::FunctionUse; + kind = matchingKind; } - } else if (!funTy->isVirtual()) { - matchType = Match_Ok; - kind = SemanticHighlighter::FunctionUse; - //continue, to check if there is a matching candidate which is virtual } else { matchType = Match_Ok; - kind = SemanticHighlighter::VirtualMethodUse; - break; + kind = matchingKind; + if (isVirtual) + break; + // else continue, to check if there is a matching candidate which is virtual } } @@ -1326,7 +1338,7 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST if (highlightCtorDtorAsType && (isConstructor || isDestructor) && maybeType(ast->name) - && kind == SemanticHighlighter::FunctionUse) { + && kind == SemanticHighlighter::FunctionDeclarationUse) { return false; } diff --git a/src/plugins/cpptools/cppchecksymbols.h b/src/plugins/cpptools/cppchecksymbols.h index 1cbd3f1030..f615341ed0 100644 --- a/src/plugins/cpptools/cppchecksymbols.h +++ b/src/plugins/cpptools/cppchecksymbols.h @@ -94,6 +94,12 @@ protected: using ASTVisitor::visit; using ASTVisitor::endVisit; + enum FunctionKind + { + FunctionDeclaration, + FunctionCall + }; + CheckSymbols(CPlusPlus::Document::Ptr doc, const CPlusPlus::LookupContext &context, const QList<Result> &otherUses); @@ -126,7 +132,8 @@ protected: bool maybeAddField(const QList<CPlusPlus::LookupItem> &candidates, CPlusPlus::NameAST *ast); bool maybeAddFunction(const QList<CPlusPlus::LookupItem> &candidates, - CPlusPlus::NameAST *ast, unsigned argumentCount); + CPlusPlus::NameAST *ast, unsigned argumentCount, + FunctionKind functionKind); bool isTemplateClass(CPlusPlus::Symbol *s) const; diff --git a/src/plugins/cpptools/semantichighlighter.cpp b/src/plugins/cpptools/semantichighlighter.cpp index df0107ba63..c0d0ceefa6 100644 --- a/src/plugins/cpptools/semantichighlighter.cpp +++ b/src/plugins/cpptools/semantichighlighter.cpp @@ -134,6 +134,14 @@ unsigned SemanticHighlighter::documentRevision() const return m_baseTextDocument->document()->revision(); } +static TextStyles mixinStyle(TextStyle main, TextStyle mixin) +{ + TextStyles res; + res.mainStyle = main; + res.mixinStyles.push_back(mixin); + return res; +} + void SemanticHighlighter::updateFormatMapFromFontSettings() { QTC_ASSERT(m_baseTextDocument, return); @@ -148,6 +156,10 @@ void SemanticHighlighter::updateFormatMapFromFontSettings() m_formatMap[LabelUse] = fs.toTextCharFormat(C_LABEL); m_formatMap[MacroUse] = fs.toTextCharFormat(C_PREPROCESSOR); m_formatMap[FunctionUse] = fs.toTextCharFormat(C_FUNCTION); + m_formatMap[FunctionDeclarationUse] = + fs.toTextCharFormat(mixinStyle(C_FUNCTION, C_DECLARATION)); + m_formatMap[VirtualFunctionDeclarationUse] = + fs.toTextCharFormat(mixinStyle(C_VIRTUAL_METHOD, C_DECLARATION)); m_formatMap[PseudoKeywordUse] = fs.toTextCharFormat(C_KEYWORD); m_formatMap[StringUse] = fs.toTextCharFormat(C_STRING); } diff --git a/src/plugins/cpptools/semantichighlighter.h b/src/plugins/cpptools/semantichighlighter.h index 801d4d6af4..47e4939b9a 100644 --- a/src/plugins/cpptools/semantichighlighter.h +++ b/src/plugins/cpptools/semantichighlighter.h @@ -56,7 +56,9 @@ public: MacroUse, FunctionUse, PseudoKeywordUse, - StringUse + StringUse, + FunctionDeclarationUse, + VirtualFunctionDeclarationUse, }; typedef std::function<QFuture<TextEditor::HighlightingResult> ()> HighlightingRunner; diff --git a/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp b/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp index ccabb8c61f..2c2564f8d6 100644 --- a/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp +++ b/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp @@ -66,9 +66,11 @@ static QString useKindToString(UseKind useKind) CASE_STR(FieldUse); CASE_STR(EnumerationUse); CASE_STR(VirtualMethodUse); + CASE_STR(VirtualFunctionDeclarationUse); CASE_STR(LabelUse); CASE_STR(MacroUse); CASE_STR(FunctionUse); + CASE_STR(FunctionDeclarationUse); CASE_STR(PseudoKeywordUse); CASE_STR(StringUse); default: @@ -254,7 +256,7 @@ void tst_CheckSymbols::test_checksymbols_data() " int i;\n" "}\n") << (UseList() - << Use(1, 5, 1, Highlighting::FunctionUse) + << Use(1, 5, 1, Highlighting::FunctionDeclarationUse) << Use(3, 8, 1, Highlighting::LocalUse)); QTest::newRow("FieldUse") @@ -272,7 +274,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(2, 9, 1, Highlighting::FieldUse) << Use(3, 5, 1, Highlighting::TypeUse) << Use(3, 11, 1, Highlighting::FieldUse) - << Use(5, 5, 1, Highlighting::FunctionUse) + << Use(5, 5, 1, Highlighting::FunctionDeclarationUse) << Use(7, 5, 1, Highlighting::TypeUse) << Use(7, 7, 1, Highlighting::LocalUse) << Use(8, 5, 1, Highlighting::LocalUse) @@ -289,19 +291,24 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(2, 1, 1, Highlighting::TypeUse) << Use(2, 7, 3, Highlighting::EnumerationUse)); - QTest::newRow("VirtualMethodUse") + QTest::newRow("VirtualFunction") << _("class B {\n" // 1 " virtual bool isThere();\n" // 2 - "};\n" // 3 - "class D: public B {\n" // 4 - " bool isThere();\n" // 5 + " bool nonVirtual() {\n" // 3 + " return isThere();\n" // 4 + " }\n" // 5 + "};\n" // 6 + "class D: public B {\n" // 7 + " bool isThere();\n" // 8 "};\n") << (UseList() << Use(1, 7, 1, Highlighting::TypeUse) // B - << Use(2, 18, 7, Highlighting::VirtualMethodUse) // isThere - << Use(4, 7, 1, Highlighting::TypeUse) // D - << Use(4, 17, 1, Highlighting::TypeUse) // B - << Use(5, 10, 7, Highlighting::VirtualMethodUse)); // isThere + << Use(2, 18, 7, Highlighting::VirtualFunctionDeclarationUse) // isThere + << Use(3, 10, 10, Highlighting::FunctionDeclarationUse) // nonVirtual + << Use(4, 16, 7, Highlighting::VirtualMethodUse) // isThere call + << Use(7, 7, 1, Highlighting::TypeUse) // D + << Use(7, 17, 1, Highlighting::TypeUse) // B + << Use(8, 10, 7, Highlighting::VirtualFunctionDeclarationUse)); // isThere QTest::newRow("LabelUse") << _("int f()\n" @@ -310,7 +317,7 @@ void tst_CheckSymbols::test_checksymbols_data() " g: return 1;\n" "}\n") << (UseList() - << Use(1, 5, 1, Highlighting::FunctionUse) + << Use(1, 5, 1, Highlighting::FunctionDeclarationUse) << Use(3, 9, 1, Highlighting::LabelUse) << Use(4, 4, 1, Highlighting::LabelUse)); @@ -318,8 +325,8 @@ void tst_CheckSymbols::test_checksymbols_data() << _("int f();\n" "int g() { f(); }\n") << (UseList() - << Use(1, 5, 1, Highlighting::FunctionUse) - << Use(2, 5, 1, Highlighting::FunctionUse) + << Use(1, 5, 1, Highlighting::FunctionDeclarationUse) + << Use(2, 5, 1, Highlighting::FunctionDeclarationUse) << Use(2, 11, 1, Highlighting::FunctionUse)); QTest::newRow("PseudoKeywordUse") @@ -329,9 +336,9 @@ void tst_CheckSymbols::test_checksymbols_data() "};\n") << (UseList() << Use(1, 7, 1, Highlighting::TypeUse) - << Use(2, 17, 1, Highlighting::VirtualMethodUse) + << Use(2, 17, 1, Highlighting::VirtualFunctionDeclarationUse) << Use(2, 21, 8, Highlighting::PseudoKeywordUse) - << Use(3, 17, 1, Highlighting::VirtualMethodUse) + << Use(3, 17, 1, Highlighting::VirtualFunctionDeclarationUse) << Use(3, 21, 5, Highlighting::PseudoKeywordUse)); QTest::newRow("StaticUse") @@ -359,12 +366,12 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(4, 12, 5, Highlighting::TypeUse) << Use(6, 9, 5, Highlighting::TypeUse) << Use(6, 16, 5, Highlighting::FieldUse) - << Use(7, 14, 3, Highlighting::FunctionUse) + << Use(7, 14, 3, Highlighting::FunctionDeclarationUse) << Use(11, 5, 5, Highlighting::TypeUse) << Use(11, 12, 3, Highlighting::FieldUse) << Use(13, 6, 5, Highlighting::TypeUse) << Use(13, 13, 5, Highlighting::TypeUse) - << Use(13, 20, 3, Highlighting::FunctionUse) + << Use(13, 20, 3, Highlighting::FunctionDeclarationUse) << Use(15, 5, 3, Highlighting::FieldUse) << Use(16, 5, 5, Highlighting::TypeUse) << Use(16, 12, 3, Highlighting::FieldUse) @@ -416,7 +423,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(6, 21, 1, Highlighting::TypeUse) << Use(6, 23, 2, Highlighting::FieldUse) << Use(6, 29, 6, Highlighting::FieldUse) - << Use(9, 6, 3, Highlighting::FunctionUse) + << Use(9, 6, 3, Highlighting::FunctionDeclarationUse) << Use(11, 5, 5, Highlighting::TypeUse) << Use(11, 11, 3, Highlighting::TypeUse) << Use(11, 16, 4, Highlighting::LocalUse) @@ -437,8 +444,8 @@ void tst_CheckSymbols::test_checksymbols_data() "}\n") << (UseList() << Use(1, 8, 3, Highlighting::TypeUse) - << Use(3, 16, 3, Highlighting::FunctionUse) - << Use(6, 6, 3, Highlighting::FunctionUse) + << Use(3, 16, 3, Highlighting::FunctionDeclarationUse) + << Use(6, 6, 3, Highlighting::FunctionDeclarationUse) << Use(8, 9, 3, Highlighting::LocalUse) << Use(8, 15, 3, Highlighting::TypeUse) << Use(8, 20, 3, Highlighting::FunctionUse)); @@ -455,8 +462,8 @@ void tst_CheckSymbols::test_checksymbols_data() "}\n") << (UseList() << Use(1, 8, 3, Highlighting::TypeUse) - << Use(3, 16, 3, Highlighting::FunctionUse) - << Use(6, 6, 3, Highlighting::FunctionUse) + << Use(3, 16, 3, Highlighting::FunctionDeclarationUse) + << Use(6, 6, 3, Highlighting::FunctionDeclarationUse) << Use(6, 14, 3, Highlighting::LocalUse) << Use(8, 5, 3, Highlighting::TypeUse) << Use(8, 10, 3, Highlighting::FunctionUse)); @@ -474,9 +481,9 @@ void tst_CheckSymbols::test_checksymbols_data() "}\n") << (UseList() << Use(1, 8, 3, Highlighting::TypeUse) - << Use(3, 16, 3, Highlighting::FunctionUse) + << Use(3, 16, 3, Highlighting::FunctionDeclarationUse) << Use(6, 17, 3, Highlighting::TypeUse) - << Use(7, 6, 3, Highlighting::FunctionUse) + << Use(7, 6, 3, Highlighting::FunctionDeclarationUse) << Use(9, 5, 3, Highlighting::TypeUse) << Use(9, 10, 3, Highlighting::FunctionUse)); @@ -493,9 +500,9 @@ void tst_CheckSymbols::test_checksymbols_data() "}\n") << (UseList() << Use(1, 8, 3, Highlighting::TypeUse) - << Use(3, 16, 3, Highlighting::FunctionUse) + << Use(3, 16, 3, Highlighting::FunctionDeclarationUse) << Use(6, 8, 3, Highlighting::TypeUse) - << Use(7, 6, 3, Highlighting::FunctionUse) + << Use(7, 6, 3, Highlighting::FunctionDeclarationUse) << Use(9, 5, 3, Highlighting::TypeUse) << Use(9, 10, 3, Highlighting::FunctionUse)); @@ -524,14 +531,14 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(1, 16, 1, Highlighting::TypeUse) << Use(1, 25, 5, Highlighting::TypeUse) << Use(3, 9, 1, Highlighting::TypeUse) - << Use(3, 11, 8, Highlighting::FunctionUse) + << Use(3, 11, 8, Highlighting::FunctionDeclarationUse) << Use(6, 16, 1, Highlighting::TypeUse) << Use(6, 25, 8, Highlighting::TypeUse) << Use(8, 9, 1, Highlighting::TypeUse) - << Use(8, 12, 8, Highlighting::FunctionUse) + << Use(8, 12, 8, Highlighting::FunctionDeclarationUse) << Use(11, 7, 3, Highlighting::TypeUse) - << Use(12, 10, 3, Highlighting::FunctionUse) - << Use(15, 6, 1, Highlighting::FunctionUse) + << Use(12, 10, 3, Highlighting::FunctionDeclarationUse) + << Use(15, 6, 1, Highlighting::FunctionDeclarationUse) << Use(17, 5, 5, Highlighting::TypeUse) << Use(17, 11, 8, Highlighting::TypeUse) << Use(17, 20, 3, Highlighting::TypeUse) @@ -563,9 +570,9 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(1, 17, 1, Highlighting::TypeUse) << Use(2, 7, 9, Highlighting::TypeUse) << Use(5, 12, 1, Highlighting::TypeUse) - << Use(5, 15, 8, Highlighting::FunctionUse) - << Use(8, 6, 3, Highlighting::FunctionUse) - << Use(10, 6, 3, Highlighting::FunctionUse); + << Use(5, 15, 8, Highlighting::FunctionDeclarationUse) + << Use(8, 6, 3, Highlighting::FunctionDeclarationUse) + << Use(10, 6, 3, Highlighting::FunctionDeclarationUse); for (int i = 0; i < 250; ++i) { excessiveUses << Use(12 + i, 5, 9, Highlighting::TypeUse) @@ -600,11 +607,11 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(4, 8, 5, Highlighting::TypeUse) << Use(6, 10, 6, Highlighting::TypeUse) << Use(8, 11, 1, Highlighting::TypeUse) - << Use(8, 14, 8, Highlighting::FunctionUse) + << Use(8, 14, 8, Highlighting::FunctionDeclarationUse) << Use(8, 35, 1, Highlighting::FieldUse) << Use(9, 5, 1, Highlighting::TypeUse) << Use(9, 7, 1, Highlighting::FieldUse) - << Use(13, 6, 3, Highlighting::FunctionUse) + << Use(13, 6, 3, Highlighting::FunctionDeclarationUse) << Use(15, 3, 5, Highlighting::TypeUse) << Use(15, 9, 3, Highlighting::TypeUse) << Use(15, 15, 6, Highlighting::TypeUse) @@ -625,8 +632,8 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(1, 8, 1, Highlighting::TypeUse) << Use(2, 8, 1, Highlighting::TypeUse) << Use(3, 23, 1, Highlighting::TypeUse) - << Use(3, 30, 1, Highlighting::FunctionUse) - << Use(4, 10, 1, Highlighting::FunctionUse) + << Use(3, 30, 1, Highlighting::FunctionDeclarationUse) + << Use(4, 10, 1, Highlighting::FunctionDeclarationUse) << Use(5, 9, 1, Highlighting::FunctionUse) << Use(5, 11, 1, Highlighting::TypeUse) << Use(6, 15, 1, Highlighting::FunctionUse) @@ -644,7 +651,7 @@ void tst_CheckSymbols::test_checksymbols_data() "}\n") << (UseList() << Use(3, 7, 3, Highlighting::FieldUse) - << Use(6, 6, 3, Highlighting::FunctionUse)); + << Use(6, 6, 3, Highlighting::FunctionDeclarationUse)); QTest::newRow("QTCREATORBUG9098") << _("template <typename T>\n" @@ -673,7 +680,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(11, 5, 1, Highlighting::TypeUse) << Use(11, 7, 1, Highlighting::TypeUse) << Use(11, 10, 1, Highlighting::FieldUse) - << Use(12, 10, 3, Highlighting::FunctionUse) + << Use(12, 10, 3, Highlighting::FunctionDeclarationUse) << Use(14, 9, 1, Highlighting::FieldUse) << Use(14, 11, 1, Highlighting::FieldUse)); @@ -702,17 +709,17 @@ void tst_CheckSymbols::test_checksymbols_data() "}\n") << (UseList() << Use(1, 14, 4, Highlighting::FieldUse) - << Use(2, 6, 4, Highlighting::FunctionUse) + << Use(2, 6, 4, Highlighting::FunctionDeclarationUse) << Use(4, 8, 4, Highlighting::FieldUse) << Use(6, 11, 3, Highlighting::TypeUse) << Use(7, 16, 4, Highlighting::FieldUse) - << Use(8, 8, 4, Highlighting::FunctionUse) + << Use(8, 8, 4, Highlighting::FunctionDeclarationUse) << Use(10, 10, 4, Highlighting::FieldUse) << Use(13, 11, 3, Highlighting::TypeUse) << Use(15, 27, 4, Highlighting::FieldUse) - << Use(16, 10, 4, Highlighting::FunctionUse) + << Use(16, 10, 4, Highlighting::FunctionDeclarationUse) << Use(16, 19, 4, Highlighting::FieldUse) - << Use(18, 8, 4, Highlighting::FunctionUse) + << Use(18, 8, 4, Highlighting::FunctionDeclarationUse) << Use(20, 10, 4, Highlighting::FieldUse)); QTest::newRow("AnonymousClass_insideFunction") @@ -725,7 +732,7 @@ void tst_CheckSymbols::test_checksymbols_data() " };\n" "}\n") << (UseList() - << Use(1, 5, 3, Highlighting::FunctionUse) + << Use(1, 5, 3, Highlighting::FunctionDeclarationUse) << Use(5, 13, 4, Highlighting::FieldUse) << Use(6, 13, 4, Highlighting::FieldUse)); @@ -750,7 +757,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(5, 9, 5, Highlighting::FieldUse) << Use(6, 9, 8, Highlighting::FieldUse) << Use(7, 3, 6, Highlighting::TypeUse) - << Use(8, 6, 3, Highlighting::FunctionUse) + << Use(8, 6, 3, Highlighting::FunctionDeclarationUse) << Use(10, 5, 6, Highlighting::TypeUse) << Use(10, 12, 1, Highlighting::LocalUse) << Use(11, 5, 1, Highlighting::LocalUse) @@ -769,7 +776,7 @@ void tst_CheckSymbols::test_checksymbols_data() " n.i = 42;\n" "}\n") << (UseList() - << Use(1, 5, 3, Highlighting::FunctionUse) + << Use(1, 5, 3, Highlighting::FunctionDeclarationUse) << Use(3, 12, 6, Highlighting::TypeUse) << Use(5, 13, 1, Highlighting::FieldUse) << Use(6, 7, 1, Highlighting::LocalUse) @@ -790,7 +797,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(2, 7, 3, Highlighting::TypeUse) << Use(4, 7, 2, Highlighting::TypeUse) << Use(4, 11, 3, Highlighting::TypeUse) - << Use(5, 6, 3, Highlighting::FunctionUse) + << Use(5, 6, 3, Highlighting::FunctionDeclarationUse) << Use(7, 5, 3, Highlighting::TypeUse) << Use(7, 9, 3, Highlighting::LocalUse)); @@ -811,7 +818,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(4, 11, 3, Highlighting::TypeUse) << Use(5, 7, 2, Highlighting::TypeUse) << Use(5, 11, 3, Highlighting::TypeUse) - << Use(6, 6, 3, Highlighting::FunctionUse) + << Use(6, 6, 3, Highlighting::FunctionDeclarationUse) << Use(8, 5, 3, Highlighting::TypeUse) << Use(8, 9, 3, Highlighting::LocalUse)); @@ -827,7 +834,7 @@ void tst_CheckSymbols::test_checksymbols_data() << (UseList() << Use(1, 11, 2, Highlighting::TypeUse) << Use(2, 7, 3, Highlighting::TypeUse) - << Use(4, 6, 3, Highlighting::FunctionUse) + << Use(4, 6, 3, Highlighting::FunctionDeclarationUse) << Use(6, 11, 2, Highlighting::TypeUse) << Use(6, 15, 3, Highlighting::TypeUse) << Use(7, 5, 3, Highlighting::TypeUse) @@ -845,7 +852,7 @@ void tst_CheckSymbols::test_checksymbols_data() << (UseList() << Use(1, 11, 2, Highlighting::TypeUse) << Use(2, 7, 3, Highlighting::TypeUse) - << Use(5, 6, 3, Highlighting::FunctionUse) + << Use(5, 6, 3, Highlighting::FunctionDeclarationUse) << Use(7, 9, 3, Highlighting::LocalUse)); QTest::newRow("crashWhenUsingNamespaceClass_QTCREATORBUG9323_namespace") @@ -863,7 +870,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(1, 11, 2, Highlighting::TypeUse) << Use(2, 7, 3, Highlighting::TypeUse) << Use(4, 11, 3, Highlighting::TypeUse) - << Use(6, 6, 3, Highlighting::FunctionUse) + << Use(6, 6, 3, Highlighting::FunctionDeclarationUse) << Use(8, 9, 3, Highlighting::LocalUse)); QTest::newRow("crashWhenUsingNamespaceClass_QTCREATORBUG9323_insideFunction") @@ -878,7 +885,7 @@ void tst_CheckSymbols::test_checksymbols_data() << (UseList() << Use(1, 11, 2, Highlighting::TypeUse) << Use(2, 7, 3, Highlighting::TypeUse) - << Use(4, 6, 3, Highlighting::FunctionUse) + << Use(4, 6, 3, Highlighting::FunctionDeclarationUse) << Use(7, 9, 3, Highlighting::LocalUse)); QTest::newRow("alias_decl_QTCREATORBUG9386") @@ -897,7 +904,7 @@ void tst_CheckSymbols::test_checksymbols_data() " }\n" "}\n") << (UseList() - << Use(1, 6, 3, Highlighting::FunctionUse) + << Use(1, 6, 3, Highlighting::FunctionDeclarationUse) << Use(4, 13, 1, Highlighting::TypeUse) << Use(4, 17, 2, Highlighting::EnumerationUse) << Use(4, 21, 2, Highlighting::EnumerationUse) @@ -913,7 +920,7 @@ void tst_CheckSymbols::test_checksymbols_data() " E e = e1;\n" "}\n") << (UseList() - << Use(1, 6, 3, Highlighting::FunctionUse) + << Use(1, 6, 3, Highlighting::FunctionDeclarationUse) << Use(3, 9, 1, Highlighting::TypeUse) << Use(3, 13, 2, Highlighting::EnumerationUse) << Use(3, 17, 2, Highlighting::EnumerationUse) @@ -944,7 +951,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(6, 11, 2, Highlighting::TypeUse) << Use(8, 11, 3, Highlighting::TypeUse) << Use(8, 16, 10, Highlighting::TypeUse) - << Use(10, 6, 3, Highlighting::FunctionUse) + << Use(10, 6, 3, Highlighting::FunctionDeclarationUse) << Use(12, 5, 2, Highlighting::TypeUse) << Use(12, 9, 10, Highlighting::TypeUse) << Use(12, 20, 1, Highlighting::TypeUse) @@ -965,7 +972,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(3, 27, 3, Highlighting::TypeUse) << Use(4, 11, 2, Highlighting::TypeUse) << Use(4, 15, 3, Highlighting::TypeUse) - << Use(6, 6, 3, Highlighting::FunctionUse) + << Use(6, 6, 3, Highlighting::FunctionDeclarationUse) << Use(8, 5, 3, Highlighting::TypeUse) << Use(8, 9, 3, Highlighting::LocalUse) ); @@ -991,7 +998,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(4, 11, 2, Highlighting::TypeUse) << Use(4, 15, 3, Highlighting::TypeUse) << Use(6, 11, 3, Highlighting::TypeUse) - << Use(8, 10, 3, Highlighting::FunctionUse) + << Use(8, 10, 3, Highlighting::FunctionDeclarationUse) << Use(10, 13, 3, Highlighting::LocalUse) ); @@ -1011,7 +1018,7 @@ void tst_CheckSymbols::test_checksymbols_data() << (UseList() << Use(1, 7, 10, Highlighting::TypeUse) << Use(1, 24, 10, Highlighting::FieldUse) - << Use(2, 6, 1, Highlighting::FunctionUse) + << Use(2, 6, 1, Highlighting::FunctionDeclarationUse) << Use(2, 8, 10, Highlighting::TypeUse) << Use(2, 19, 7, Highlighting::LocalUse) << Use(3, 3, 7, Highlighting::LocalUse) @@ -1039,7 +1046,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(2, 33, 4, Highlighting::TypeUse) << Use(3, 3, 4, Highlighting::TypeUse) << Use(4, 3, 4, Highlighting::TypeUse) - << Use(6, 6, 4, Highlighting::FunctionUse) + << Use(6, 6, 4, Highlighting::FunctionDeclarationUse) << Use(6, 15, 12, Highlighting::LocalUse) << Use(7, 13, 30, Highlighting::LocalUse) << Use(8, 3, 4, Highlighting::TypeUse) @@ -1073,7 +1080,7 @@ void tst_CheckSymbols::test_checksymbols_data() << (UseList() << Use(1, 7, 10, Highlighting::TypeUse) << Use(1, 24, 10, Highlighting::FieldUse) - << Use(2, 6, 1, Highlighting::FunctionUse) + << Use(2, 6, 1, Highlighting::FunctionDeclarationUse) << Use(2, 8, 10, Highlighting::TypeUse) << Use(2, 19, 7, Highlighting::LocalUse) << Use(3, 3, 7, Highlighting::LocalUse) @@ -1095,7 +1102,7 @@ void tst_CheckSymbols::test_checksymbols_data() << Use(5, 6, 5, Highlighting::TypeUse) << Use(5, 6, 5, Highlighting::TypeUse) << Use(8, 1, 5, Highlighting::TypeUse) - << Use(8, 8, 5, Highlighting::FunctionUse) + << Use(8, 8, 5, Highlighting::FunctionDeclarationUse) << Use(9, 1, 5, Highlighting::TypeUse) << Use(9, 1, 5, Highlighting::TypeUse) << Use(9, 9, 5, Highlighting::TypeUse)); @@ -1114,7 +1121,7 @@ void tst_CheckSymbols::test_checksymbols_data() "};\n") << (UseList() << Use(6, 7, 3, Highlighting::TypeUse) - << Use(7, 8, 1, Highlighting::FunctionUse) + << Use(7, 8, 1, Highlighting::FunctionDeclarationUse) << Use(8, 1, 3, Highlighting::TypeUse) << Use(8, 6, 1, Highlighting::FieldUse)); #undef UC_U10302_12TIMES @@ -1141,7 +1148,7 @@ void tst_CheckSymbols::test_checksymbols_macroUses_data() "int f() { FOO; }\n") << (UseList() << Use(1, 9, 3, Highlighting::MacroUse) - << Use(2, 5, 1, Highlighting::FunctionUse) + << Use(2, 5, 1, Highlighting::FunctionDeclarationUse) << Use(2, 11, 3, Highlighting::MacroUse)) << (UseList() << Use(1, 9, 3, Highlighting::MacroUse) |