Commit 43df685c authored by Roberto Raggi's avatar Roberto Raggi

Removed useless arguments

parent 04a6d467
......@@ -35,6 +35,7 @@
#include <Names.h>
#include <Symbols.h>
#include <AST.h>
#include <TranslationUnit.h>
#include <QtCore/QDir>
......@@ -63,16 +64,20 @@ QList<Usage> FindUsages::usages() const
QList<int> FindUsages::references() const
{ return _references; }
void FindUsages::operator()(Symbol *symbol, const Identifier *id, AST *ast)
void FindUsages::operator()(Symbol *symbol)
{
_processed.clear();
_references.clear();
_usages.clear();
_declSymbol = symbol;
_id = id;
if (_declSymbol && _id) {
_id = 0;
if (_declSymbol && 0 != & (_id = _declSymbol->identifier()))
_id = _doc->control()->findOrInsertIdentifier(_id->chars(), _id->size());
if (_id) {
_exprDoc = Document::create("<references>");
accept(ast);
accept(_doc->translationUnit()->ast());
}
}
......
......@@ -64,7 +64,7 @@ public:
void setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBinding);
void operator()(Symbol *symbol, const Identifier *id, AST *ast);
void operator()(Symbol *symbol);
QList<Usage> usages() const;
QList<int> references() const;
......
......@@ -79,21 +79,11 @@ QList<int> CppFindReferences::references(Symbol *symbol,
Document::Ptr doc,
const Snapshot& snapshot) const
{
const Identifier *id = 0;
if (const Identifier *symbolId = symbol->identifier())
id = doc->control()->findIdentifier(symbolId->chars(), symbolId->size());
QList<int> references;
if (! id)
return references;
TranslationUnit *translationUnit = doc->translationUnit();
Q_ASSERT(translationUnit != 0);
FindUsages findUsages(doc, snapshot, /*future = */ 0);
findUsages.setGlobalNamespaceBinding(bind(doc, snapshot));
findUsages(symbol, id, translationUnit->ast());
findUsages(symbol);
references = findUsages.references();
return references;
......@@ -165,26 +155,13 @@ static void find_helper(QFutureInterface<Usage> &future,
doc->tokenize();
Control *control = doc->control();
if (const Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) {
QTime tm;
tm.start();
doc->parse();
//qDebug() << "***" << unit->fileName() << "parsed in:" << tm.elapsed();
tm.start();
if (control->findIdentifier(symbolId->chars(), symbolId->size()) != 0) {
doc->check();
//qDebug() << "***" << unit->fileName() << "checked in:" << tm.elapsed();
tm.start();
FindUsages process(doc, snapshot, &future);
process.setGlobalNamespaceBinding(bind(doc, snapshot));
TranslationUnit *unit = doc->translationUnit();
process(symbol, id, unit->ast());
//qDebug() << "***" << unit->fileName() << "processed in:" << tm.elapsed();
process(symbol);
}
}
......
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