summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/cppeditor/cppcheckundefinedsymbols.cpp18
-rw-r--r--src/plugins/cppeditor/cppcheckundefinedsymbols.h3
2 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/cppeditor/cppcheckundefinedsymbols.cpp b/src/plugins/cppeditor/cppcheckundefinedsymbols.cpp
index bf3f3dfdd9..7e9bffa9c1 100644
--- a/src/plugins/cppeditor/cppcheckundefinedsymbols.cpp
+++ b/src/plugins/cppeditor/cppcheckundefinedsymbols.cpp
@@ -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();
+}
diff --git a/src/plugins/cppeditor/cppcheckundefinedsymbols.h b/src/plugins/cppeditor/cppcheckundefinedsymbols.h
index f331efdc96..14c9335a76 100644
--- a/src/plugins/cppeditor/cppcheckundefinedsymbols.h
+++ b/src/plugins/cppeditor/cppcheckundefinedsymbols.h
@@ -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;
};