Commit f30f1b66 authored by Roberto Raggi's avatar Roberto Raggi

Compress the usages.

parent 5cd3afcd
......@@ -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();
}
......@@ -89,6 +89,8 @@ protected:
unsigned startOfTemplateDeclaration(TemplateDeclarationAST *ast) const;
Scope *findScope(AST *ast) const;
void flush();
private:
Document::Ptr _doc;
LookupContext _context;
......@@ -97,6 +99,7 @@ private:
QSet<QByteArray> _potentialTypes;
QList<ScopedSymbol *> _scopes;
QList<TemplateDeclarationAST *> _templateDeclarationStack;
QVector<Use> _typeUsages;
QFutureInterface<Use> *_future;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment