C++: Fix semantic highlighter and tests.

Fixed the chunk size calculation, made the sorting more stable, and
fixed the tests.

Change-Id: I81fcffbf2ce9b63dd81f1a0e251200a31220db88
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2013-03-04 13:05:40 +01:00
committed by Nikolai Kosjar
parent f4a9f56e3e
commit 4cf1ccd161
3 changed files with 46 additions and 40 deletions

View File

@@ -285,7 +285,10 @@ protected:
static bool sortByLinePredicate(const CheckSymbols::Use &lhs, const CheckSymbols::Use &rhs)
{
return lhs.line < rhs.line;
if (lhs.line == rhs.line)
return lhs.column < rhs.column;
else
return lhs.line < rhs.line;
}
@@ -325,7 +328,7 @@ CheckSymbols::CheckSymbols(Document::Ptr doc, const LookupContext &context, cons
unsigned line = 0;
getTokenEndPosition(translationUnit()->ast()->lastToken(), &line, 0);
_chunkSize = qMin(50U, line / 200);
_chunkSize = qMax(50U, line / 200);
_usages.reserve(_chunkSize);
_astStack.reserve(200);