Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tobias Hunger
qt-creator
Commits
3c51e5b2
Commit
3c51e5b2
authored
Oct 06, 2009
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return the class declaration as canonical symbol for ctors, dtors, and class names.
parent
ef0e1a64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
13 deletions
+34
-13
src/libs/cplusplus/LookupContext.cpp
src/libs/cplusplus/LookupContext.cpp
+20
-1
src/plugins/cpptools/cppfindreferences.cpp
src/plugins/cpptools/cppfindreferences.cpp
+14
-12
No files found.
src/libs/cplusplus/LookupContext.cpp
View file @
3c51e5b2
...
@@ -504,10 +504,29 @@ void LookupContext::expand(Scope *scope,
...
@@ -504,10 +504,29 @@ void LookupContext::expand(Scope *scope,
Symbol
*
LookupContext
::
canonicalSymbol
(
Symbol
*
symbol
)
Symbol
*
LookupContext
::
canonicalSymbol
(
Symbol
*
symbol
)
{
{
Symbol
*
canonical
=
symbol
;
Symbol
*
canonical
=
symbol
;
Class
*
canonicalClass
=
0
;
for
(;
symbol
;
symbol
=
symbol
->
next
())
{
for
(;
symbol
;
symbol
=
symbol
->
next
())
{
if
(
symbol
->
name
()
==
canonical
->
name
())
if
(
symbol
->
identifier
()
==
canonical
->
identifier
())
{
canonical
=
symbol
;
canonical
=
symbol
;
if
(
Class
*
klass
=
symbol
->
asClass
())
canonicalClass
=
klass
;
}
}
if
(
canonicalClass
)
{
Q_ASSERT
(
canonical
!=
0
);
if
(
canonical
->
isForwardClassDeclaration
())
return
canonicalClass
;
// prefer class declarations when available.
}
if
(
canonical
&&
canonical
->
scope
()
->
isClassScope
())
{
Class
*
enclosingClass
=
canonical
->
scope
()
->
owner
()
->
asClass
();
if
(
enclosingClass
->
identifier
()
==
canonical
->
identifier
())
return
enclosingClass
;
}
}
return
canonical
;
return
canonical
;
...
...
src/plugins/cpptools/cppfindreferences.cpp
View file @
3c51e5b2
...
@@ -304,14 +304,22 @@ protected:
...
@@ -304,14 +304,22 @@ protected:
}
}
}
}
if
(
ast
->
unqualified_name
)
{
if
(
NameAST
*
unqualified_name
=
ast
->
unqualified_name
)
{
SimpleNameAST
*
simple_name
=
ast
->
unqualified_name
->
asSimpleName
();
unsigned
identifier_token
=
0
;
if
(
SimpleNameAST
*
simple_name
=
unqualified_name
->
asSimpleName
())
identifier_token
=
simple_name
->
identifier_token
;
else
if
(
DestructorNameAST
*
dtor_name
=
unqualified_name
->
asDestructorName
())
identifier_token
=
dtor_name
->
identifier_token
;
TemplateIdAST
*
template_id
=
0
;
TemplateIdAST
*
template_id
=
0
;
if
(
!
simple_name
)
{
if
(
!
identifier_token
)
{
template_id
=
ast
->
unqualified_name
->
asTemplateId
();
template_id
=
unqualified_name
->
asTemplateId
();
if
(
template_id
)
{
if
(
template_id
)
{
identifier_token
=
template_id
->
identifier_token
;
for
(
TemplateArgumentListAST
*
template_arguments
=
template_id
->
template_arguments
;
for
(
TemplateArgumentListAST
*
template_arguments
=
template_id
->
template_arguments
;
template_arguments
;
template_arguments
=
template_arguments
->
next
)
{
template_arguments
;
template_arguments
=
template_arguments
->
next
)
{
accept
(
template_arguments
->
template_argument
);
accept
(
template_arguments
->
template_argument
);
...
@@ -319,14 +327,8 @@ protected:
...
@@ -319,14 +327,8 @@ protected:
}
}
}
}
if
(
simple_name
||
template_id
)
{
if
(
identifier_token
&&
identifier
(
identifier_token
)
==
_id
)
const
unsigned
identifier_token
=
simple_name
checkExpression
(
ast
->
firstToken
(),
identifier_token
);
?
simple_name
->
identifier_token
:
template_id
->
identifier_token
;
if
(
identifier
(
identifier_token
)
==
_id
)
checkExpression
(
ast
->
firstToken
(),
identifier_token
);
}
}
}
return
false
;
return
false
;
...
...
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