Compress the usages.

This commit is contained in:
Roberto Raggi
2010-07-06 12:42:55 +02:00
parent 5cd3afcd84
commit f30f1b66de
2 changed files with 19 additions and 2 deletions

View File

@@ -278,8 +278,10 @@ void CheckUndefinedSymbols::runFunctor(QFutureInterface<Use> &future)
_future = &future;
_diagnosticMessages.clear();
if (_doc->translationUnit())
if (_doc->translationUnit()) {
accept(_doc->translationUnit()->ast());
flush();
}
}
bool CheckUndefinedSymbols::warning(unsigned line, unsigned column, const QString &text, unsigned length)
@@ -464,7 +466,10 @@ void CheckUndefinedSymbols::endVisit(TemplateDeclarationAST *)
void CheckUndefinedSymbols::addTypeUsage(const Use &use)
{
_future->reportResult(use); // ### TODO: compress
_typeUsages.append(use);
if (_typeUsages.size() == 50)
flush();
}
void CheckUndefinedSymbols::addTypeUsage(ClassOrNamespace *b, NameAST *ast)
@@ -548,3 +553,12 @@ Scope *CheckUndefinedSymbols::findScope(AST *ast) const
return scope;
}
void CheckUndefinedSymbols::flush()
{
if (_typeUsages.isEmpty())
return;
_future->reportResults(_typeUsages);
_typeUsages.clear();
}