summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppfindreferences.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-10-15 14:48:56 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2009-10-15 14:48:56 +0200
commite130c035d8e0970d19972330c154892a7e5ded75 (patch)
tree014812acbe164d67a7d429455b352988cf0ccaca /src/plugins/cpptools/cppfindreferences.cpp
parent24bcbaefe9ad33259a58dee87a7ce4567323baed (diff)
downloadqt-creator-e130c035d8e0970d19972330c154892a7e5ded75.tar.gz
Process the names of the formal arguments when searching references in function definitions.
Diffstat (limited to 'src/plugins/cpptools/cppfindreferences.cpp')
-rw-r--r--src/plugins/cpptools/cppfindreferences.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp
index 7e3f04bc38..eb90a18678 100644
--- a/src/plugins/cpptools/cppfindreferences.cpp
+++ b/src/plugins/cpptools/cppfindreferences.cpp
@@ -77,7 +77,8 @@ public:
_doc(doc),
_snapshot(snapshot),
_source(_doc->source()),
- _sem(doc->control())
+ _sem(doc->control()),
+ _inSimpleDeclaration(0)
{
_snapshot.insert(_doc);
}
@@ -435,8 +436,8 @@ protected:
for (PtrOperatorAST *ptr_op = declarator->ptr_operators; ptr_op; ptr_op = ptr_op->next)
accept(ptr_op);
- // ### TODO: well, not exactly. We need to look at qualified-name-ids and nested-declarators.
- // accept(declarator->core_declarator);
+ if (! _inSimpleDeclaration) // visit the core declarator only if we are not in simple-declaration.
+ accept(declarator->core_declarator);
for (PostfixDeclaratorAST *fx_op = declarator->postfix_declarators; fx_op; fx_op = fx_op->next)
accept(fx_op);
@@ -469,6 +470,15 @@ protected:
return false;
}
+ virtual bool visit(SimpleDeclarationAST *)
+ {
+ ++_inSimpleDeclaration;
+ return true;
+ }
+
+ virtual void endVisit(SimpleDeclarationAST *)
+ { --_inSimpleDeclaration; }
+
private:
QFutureInterface<Utils::FileSearchResult> *_future;
Identifier *_id; // ### remove me
@@ -482,6 +492,7 @@ private:
QList<PostfixExpressionAST *> _postfixExpressionStack;
QList<QualifiedNameAST *> _qualifiedNameStack;
QList<int> _references;
+ int _inSimpleDeclaration;
};
} // end of anonymous namespace