Commit 6ea5fdcd authored by Roberto Raggi's avatar Roberto Raggi

Speed up the search of a reference to a name.

parent 63cd7ffe
......@@ -223,6 +223,8 @@ static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future,
future.setProgressRange(0, files.size());
const QByteArray literal = word.toLatin1();
tm.start();
for (int i = 0; i < files.size(); ++i) {
const QString &fn = files.at(i);
......@@ -234,15 +236,16 @@ static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future,
const QString source = QTextStream(&f).readAll();
const QByteArray preprocessedCode = snapshot.preprocessedCode(source, fn);
Document::Ptr doc = snapshot.documentFromSource(preprocessedCode, fn);
doc->check();
doc->tokenize();
Control *control = doc->control();
Identifier *id = control->findOrInsertIdentifier(word.toLatin1().constData());
if (Identifier *id = control->findIdentifier(literal.constData(), literal.size())) {
doc->check();
TranslationUnit *unit = doc->translationUnit();
Process process(future, doc, snapshot);
process(id, unit->ast());
}
}
future.setProgressValue(files.size());
}
......
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