Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Hunger
qt-creator
Commits
b1f5a40e
Commit
b1f5a40e
authored
Sep 29, 2009
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle member expressions.
parent
5a482ace
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
2 deletions
+71
-2
src/plugins/cpptools/cppfindreferences.cpp
src/plugins/cpptools/cppfindreferences.cpp
+71
-2
No files found.
src/plugins/cpptools/cppfindreferences.cpp
View file @
b1f5a40e
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
#include <cplusplus/ExpressionUnderCursor.h>
#include <cplusplus/ExpressionUnderCursor.h>
#include <cplusplus/ResolveExpression.h>
#include <cplusplus/ResolveExpression.h>
#include <cplusplus/Overview.h>
#include <cplusplus/Overview.h>
#include <cplusplus/TypeOfExpression.h>
#include <QtCore/QTime>
#include <QtCore/QTime>
#include <QtCore/QtConcurrentRun>
#include <QtCore/QtConcurrentRun>
...
@@ -130,8 +131,17 @@ protected:
...
@@ -130,8 +131,17 @@ protected:
bool
checkCandidates
(
const
QList
<
Symbol
*>
&
candidates
)
const
bool
checkCandidates
(
const
QList
<
Symbol
*>
&
candidates
)
const
{
{
// ### FIXME return isDeclSymbol(LookupContext::canonicalSymbol(candidates));
if
(
Symbol
*
canonicalSymbol
=
LookupContext
::
canonicalSymbol
(
candidates
))
{
return
true
;
#if 0
qDebug() << "*** canonical symbol:" << canonicalSymbol->fileName()
<< canonicalSymbol->line() << canonicalSymbol->column()
<< "candidates:" << candidates.size();
#endif
return
isDeclSymbol
(
canonicalSymbol
);
}
return
false
;
}
}
bool
isDeclSymbol
(
Symbol
*
symbol
)
const
bool
isDeclSymbol
(
Symbol
*
symbol
)
const
...
@@ -158,6 +168,64 @@ protected:
...
@@ -158,6 +168,64 @@ protected:
return
LookupContext
(
lastVisibleSymbol
,
_exprDoc
,
_doc
,
_snapshot
);
return
LookupContext
(
lastVisibleSymbol
,
_exprDoc
,
_doc
,
_snapshot
);
}
}
virtual
bool
visit
(
PostfixExpressionAST
*
ast
)
{
_postfixExpressionStack
.
append
(
ast
);
return
true
;
}
virtual
void
endVisit
(
PostfixExpressionAST
*
ast
)
{
_postfixExpressionStack
.
removeLast
();
}
virtual
bool
visit
(
MemberAccessAST
*
ast
)
{
if
(
!
ast
->
member_name
)
return
false
;
SimpleNameAST
*
simple
=
ast
->
member_name
->
asSimpleName
();
if
(
!
simple
)
return
true
;
// ### TODO handle pseudo-destructors and qualified names.
Q_ASSERT
(
!
_postfixExpressionStack
.
isEmpty
());
if
(
identifier
(
simple
->
identifier_token
)
==
_id
)
{
unsigned
startOfPostfixExpression
=
_postfixExpressionStack
.
last
()
->
firstToken
();
unsigned
begin
=
tokenAt
(
startOfPostfixExpression
).
begin
();
unsigned
end
=
tokenAt
(
ast
->
member_name
->
lastToken
()
-
1
).
end
();
const
QString
expression
=
_source
.
mid
(
begin
,
end
-
begin
);
// qDebug() << "*** expression:" << expression;
TypeOfExpression
typeofExpression
;
typeofExpression
.
setSnapshot
(
_snapshot
);
unsigned
line
,
column
;
getTokenStartPosition
(
startOfPostfixExpression
,
&
line
,
&
column
);
Symbol
*
lastVisibleSymbol
=
_doc
->
findSymbolAt
(
line
,
column
);
const
QList
<
TypeOfExpression
::
Result
>
results
=
typeofExpression
(
expression
,
_doc
,
lastVisibleSymbol
,
TypeOfExpression
::
NoPreprocess
);
QList
<
Symbol
*>
candidates
;
foreach
(
TypeOfExpression
::
Result
r
,
results
)
{
FullySpecifiedType
ty
=
r
.
first
;
Symbol
*
lastVisibleSymbol
=
r
.
second
;
candidates
.
append
(
lastVisibleSymbol
);
}
if
(
checkCandidates
(
candidates
))
reportResult
(
simple
->
identifier_token
);
}
return
false
;
}
virtual
bool
visit
(
QualifiedNameAST
*
ast
)
virtual
bool
visit
(
QualifiedNameAST
*
ast
)
{
{
if
(
!
ast
->
name
)
{
if
(
!
ast
->
name
)
{
...
@@ -212,6 +280,7 @@ private:
...
@@ -212,6 +280,7 @@ private:
QByteArray
_source
;
QByteArray
_source
;
Document
::
Ptr
_exprDoc
;
Document
::
Ptr
_exprDoc
;
Semantic
_sem
;
Semantic
_sem
;
QList
<
PostfixExpressionAST
*>
_postfixExpressionStack
;
};
};
}
// end of anonymous namespace
}
// end of anonymous namespace
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment