Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
cae8a31a
Commit
cae8a31a
authored
Sep 30, 2009
by
Roberto Raggi
Browse files
FullySpecifiedType::simplified() strips references from the type.
parent
7a5b1bdd
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppcodecompletion.cpp
View file @
cae8a31a
...
...
@@ -988,10 +988,7 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
QList
<
Symbol
*>
classObjectCandidates
;
if
(
m_completionOperator
==
T_ARROW
)
{
FullySpecifiedType
ty
=
result
.
first
;
if
(
ReferenceType
*
refTy
=
ty
->
asReferenceType
())
ty
=
refTy
->
elementType
();
FullySpecifiedType
ty
=
result
.
first
.
simplified
();
if
(
Class
*
classTy
=
ty
->
asClassType
())
{
Symbol
*
symbol
=
result
.
second
;
...
...
@@ -1026,10 +1023,7 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
if
(
!
funTy
)
continue
;
ty
=
funTy
->
returnType
();
if
(
ReferenceType
*
refTy
=
ty
->
asReferenceType
())
ty
=
refTy
->
elementType
();
ty
=
funTy
->
returnType
().
simplified
();
if
(
PointerType
*
ptrTy
=
ty
->
asPointerType
())
{
if
(
NamedType
*
namedTy
=
ptrTy
->
elementType
()
->
asNamedType
())
{
...
...
@@ -1063,19 +1057,13 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
}
}
}
else
if
(
m_completionOperator
==
T_DOT
)
{
FullySpecifiedType
ty
=
result
.
first
;
if
(
ReferenceType
*
refTy
=
ty
->
asReferenceType
())
ty
=
refTy
->
elementType
();
FullySpecifiedType
ty
=
result
.
first
.
simplified
();
NamedType
*
namedTy
=
0
;
if
(
ArrayType
*
arrayTy
=
ty
->
asArrayType
())
{
// Replace . with [0]. when `ty' is an array type.
FullySpecifiedType
elementTy
=
arrayTy
->
elementType
();
if
(
ReferenceType
*
refTy
=
elementTy
->
asReferenceType
())
elementTy
=
refTy
->
elementType
();
FullySpecifiedType
elementTy
=
arrayTy
->
elementType
().
simplified
();
if
(
elementTy
->
isNamedType
()
||
elementTy
->
isPointerType
())
{
ty
=
elementTy
;
...
...
@@ -1322,9 +1310,8 @@ bool CppCodeCompletion::completeQtMethod(const QList<TypeOfExpression::Result> &
QSet
<
QString
>
signatures
;
foreach
(
const
TypeOfExpression
::
Result
&
p
,
results
)
{
FullySpecifiedType
ty
=
p
.
first
;
if
(
ReferenceType
*
refTy
=
ty
->
asReferenceType
())
ty
=
refTy
->
elementType
();
FullySpecifiedType
ty
=
p
.
first
.
simplified
();
if
(
PointerType
*
ptrTy
=
ty
->
asPointerType
())
ty
=
ptrTy
->
elementType
();
else
...
...
src/shared/cplusplus/FullySpecifiedType.cpp
View file @
cae8a31a
...
...
@@ -201,4 +201,12 @@ bool FullySpecifiedType::operator < (const FullySpecifiedType &other) const
return
_type
<
other
.
_type
;
}
FullySpecifiedType
FullySpecifiedType
::
simplified
()
const
{
if
(
const
ReferenceType
*
refTy
=
type
()
->
asReferenceType
())
return
refTy
->
elementType
().
simplified
();
return
*
this
;
}
CPLUSPLUS_END_NAMESPACE
src/shared/cplusplus/FullySpecifiedType.h
View file @
cae8a31a
...
...
@@ -119,6 +119,8 @@ public:
bool
operator
!=
(
const
FullySpecifiedType
&
other
)
const
;
bool
operator
<
(
const
FullySpecifiedType
&
other
)
const
;
FullySpecifiedType
simplified
()
const
;
private:
Type
*
_type
;
struct
Flags
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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