Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
fade61a8
Commit
fade61a8
authored
Dec 01, 2009
by
Roberto Raggi
Browse files
Use const literals.
parent
b792b934
Changes
38
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/CheckUndefinedSymbols.cpp
View file @
fade61a8
...
...
@@ -65,7 +65,7 @@ void CheckUndefinedSymbols::operator()(AST *ast)
QByteArray
CheckUndefinedSymbols
::
templateParameterName
(
NameAST
*
ast
)
const
{
if
(
ast
&&
ast
->
name
)
{
if
(
Identifier
*
id
=
ast
->
name
->
identifier
())
if
(
const
Identifier
*
id
=
ast
->
name
->
identifier
())
return
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
());
}
...
...
@@ -92,7 +92,7 @@ bool CheckUndefinedSymbols::isType(const QByteArray &name) const
Symbol
*
member
=
members
->
symbolAt
(
m
);
if
(
member
->
isTypedef
()
&&
member
->
isDeclaration
())
{
if
(
Identifier
*
id
=
member
->
identifier
())
{
if
(
const
Identifier
*
id
=
member
->
identifier
())
{
if
(
name
==
id
->
chars
())
return
true
;
}
...
...
@@ -114,7 +114,7 @@ bool CheckUndefinedSymbols::isType(const QByteArray &name) const
return
_types
.
contains
(
name
);
}
bool
CheckUndefinedSymbols
::
isType
(
Identifier
*
id
)
const
bool
CheckUndefinedSymbols
::
isType
(
const
Identifier
*
id
)
const
{
if
(
!
id
)
return
false
;
...
...
@@ -127,7 +127,7 @@ void CheckUndefinedSymbols::addType(Name *name)
if
(
!
name
)
return
;
if
(
Identifier
*
id
=
name
->
identifier
())
if
(
const
Identifier
*
id
=
name
->
identifier
())
_types
.
insert
(
QByteArray
(
id
->
chars
(),
id
->
size
()));
}
...
...
@@ -136,7 +136,7 @@ void CheckUndefinedSymbols::addProtocol(Name *name)
if
(
!
name
)
return
;
if
(
Identifier
*
id
=
name
->
identifier
())
if
(
const
Identifier
*
id
=
name
->
identifier
())
_protocols
.
insert
(
QByteArray
(
id
->
chars
(),
id
->
size
()));
}
...
...
@@ -176,7 +176,7 @@ void CheckUndefinedSymbols::buildTypeMap(NamespaceBinding *binding, QSet<Namespa
if
(
!
processed
->
contains
(
binding
))
{
processed
->
insert
(
binding
);
if
(
Identifier
*
id
=
binding
->
identifier
())
{
if
(
const
Identifier
*
id
=
binding
->
identifier
())
{
_namespaceNames
.
insert
(
QByteArray
(
id
->
chars
(),
id
->
size
()));
}
...
...
@@ -256,7 +256,7 @@ bool CheckUndefinedSymbols::visit(NamedTypeSpecifierAST *ast)
unsigned
line
,
col
;
getTokenStartPosition
(
ast
->
firstToken
(),
&
line
,
&
col
);
// qWarning() << _doc->fileName() << line << col;
}
else
if
(
Identifier
*
id
=
ast
->
name
->
name
->
identifier
())
{
}
else
if
(
const
Identifier
*
id
=
ast
->
name
->
name
->
identifier
())
{
if
(
!
isType
(
id
))
{
if
(
FunctionDeclaratorAST
*
functionDeclarator
=
currentFunctionDeclarator
())
{
if
(
functionDeclarator
->
as_cpp_initializer
)
...
...
@@ -368,7 +368,7 @@ bool CheckUndefinedSymbols::visit(BaseSpecifierAST *base)
bool
resolvedBaseClassName
=
false
;
if
(
Name
*
name
=
nameAST
->
name
)
{
Identifier
*
id
=
name
->
identifier
();
const
Identifier
*
id
=
name
->
identifier
();
const
QByteArray
spell
=
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
());
if
(
isType
(
spell
))
resolvedBaseClassName
=
true
;
...
...
@@ -406,7 +406,7 @@ bool CheckUndefinedSymbols::visit(QualifiedNameAST *ast)
QualifiedNameId
*
q
=
ast
->
name
->
asQualifiedNameId
();
for
(
unsigned
i
=
0
;
i
<
q
->
nameCount
()
-
1
;
++
i
)
{
Name
*
name
=
q
->
nameAt
(
i
);
if
(
Identifier
*
id
=
name
->
identifier
())
{
if
(
const
Identifier
*
id
=
name
->
identifier
())
{
const
QByteArray
spell
=
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
());
if
(
!
(
_namespaceNames
.
contains
(
spell
)
||
isType
(
id
)))
{
translationUnit
()
->
warning
(
ast
->
firstToken
(),
...
...
@@ -475,7 +475,7 @@ bool CheckUndefinedSymbols::visit(ObjCClassDeclarationAST *ast)
bool
resolvedSuperClassName
=
false
;
if
(
Name
*
name
=
nameAST
->
name
)
{
Identifier
*
id
=
name
->
identifier
();
const
Identifier
*
id
=
name
->
identifier
();
const
QByteArray
spell
=
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
());
if
(
isType
(
spell
))
resolvedSuperClassName
=
true
;
...
...
@@ -497,7 +497,7 @@ bool CheckUndefinedSymbols::visit(ObjCProtocolRefsAST *ast)
bool
resolvedProtocolName
=
false
;
if
(
Name
*
name
=
nameAST
->
name
)
{
Identifier
*
id
=
name
->
identifier
();
const
Identifier
*
id
=
name
->
identifier
();
const
QByteArray
spell
=
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
());
if
(
isProtocol
(
spell
))
resolvedProtocolName
=
true
;
...
...
@@ -522,11 +522,11 @@ bool CheckUndefinedSymbols::visit(ObjCProtocolRefsAST *ast)
bool
CheckUndefinedSymbols
::
visit
(
ObjCPropertyDeclarationAST
*
ast
)
{
for
(
List
<
ObjCPropertyDeclaration
*>
*
iter
=
ast
->
symbols
;
iter
;
iter
=
iter
->
next
)
{
if
(
Name
*
getterName
=
iter
->
value
->
getterName
())
{
if
(
/*
Name *getterName =
*/
iter
->
value
->
getterName
())
{
// FIXME: resolve the symbol for the name, and check its signature.
}
if
(
Name
*
setterName
=
iter
->
value
->
setterName
())
{
if
(
/*
Name *setterName =
*/
iter
->
value
->
setterName
())
{
// FIXME: resolve the symbol for the name, and check its signature.
}
}
...
...
src/libs/cplusplus/CheckUndefinedSymbols.h
View file @
fade61a8
...
...
@@ -52,7 +52,7 @@ public:
protected:
using
ASTVisitor
::
visit
;
bool
isType
(
Identifier
*
id
)
const
;
bool
isType
(
const
Identifier
*
id
)
const
;
bool
isType
(
const
QByteArray
&
name
)
const
;
void
addType
(
Name
*
name
);
...
...
src/libs/cplusplus/CppBindings.cpp
View file @
fade61a8
...
...
@@ -57,7 +57,7 @@ Location::Location(Symbol *symbol)
_sourceLocation
(
symbol
->
sourceLocation
())
{
}
Location
::
Location
(
StringLiteral
*
fileId
,
unsigned
sourceLocation
)
Location
::
Location
(
const
StringLiteral
*
fileId
,
unsigned
sourceLocation
)
:
_fileId
(
fileId
),
_sourceLocation
(
sourceLocation
)
{
}
...
...
@@ -93,7 +93,7 @@ NameId *NamespaceBinding::name() const
return
0
;
}
Identifier
*
NamespaceBinding
::
identifier
()
const
const
Identifier
*
NamespaceBinding
::
identifier
()
const
{
if
(
NameId
*
nameId
=
name
())
return
nameId
->
identifier
();
...
...
@@ -113,7 +113,7 @@ NamespaceBinding *NamespaceBinding::globalNamespaceBinding()
return
it
;
}
Binding
*
NamespaceBinding
::
findClassOrNamespaceBinding
(
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
)
Binding
*
NamespaceBinding
::
findClassOrNamespaceBinding
(
const
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
)
{
if
(
processed
->
contains
(
this
))
return
0
;
...
...
@@ -156,7 +156,7 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
Binding
*
current
=
this
;
for
(
unsigned
i
=
0
;
i
<
q
->
nameCount
();
++
i
)
{
Identifier
*
nameId
=
q
->
nameAt
(
i
)
->
identifier
();
const
Identifier
*
nameId
=
q
->
nameAt
(
i
)
->
identifier
();
if
(
!
nameId
)
return
0
;
...
...
@@ -173,7 +173,7 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
processed
->
insert
(
this
);
Identifier
*
id
=
name
->
identifier
();
const
Identifier
*
id
=
name
->
identifier
();
foreach
(
ClassBinding
*
classBinding
,
classBindings
)
{
if
(
id
->
isEqualTo
(
classBinding
->
identifier
()))
...
...
@@ -306,7 +306,7 @@ static void closure(const Location &loc,
Q_ASSERT
(
name
->
isNameId
());
Identifier
*
id
=
name
->
asNameId
()
->
identifier
();
const
Identifier
*
id
=
name
->
asNameId
()
->
identifier
();
bool
ignoreUsingDirectives
=
false
;
foreach
(
Namespace
*
symbol
,
binding
->
symbols
)
{
...
...
@@ -394,7 +394,7 @@ QByteArray NamespaceBinding::qualifiedId() const
s
.
append
(
parent
->
qualifiedId
());
s
.
append
(
"::"
);
if
(
Identifier
*
id
=
identifier
())
if
(
const
Identifier
*
id
=
identifier
())
s
.
append
(
id
->
chars
(),
id
->
size
());
else
...
...
@@ -409,7 +409,7 @@ QByteArray ClassBinding::qualifiedId() const
QByteArray
s
=
parent
->
qualifiedId
();
s
+=
"::"
;
if
(
Identifier
*
id
=
identifier
())
if
(
const
Identifier
*
id
=
identifier
())
s
.
append
(
id
->
chars
(),
id
->
size
());
else
...
...
@@ -418,7 +418,7 @@ QByteArray ClassBinding::qualifiedId() const
return
s
;
}
Binding
*
ClassBinding
::
findClassOrNamespaceBinding
(
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
)
Binding
*
ClassBinding
::
findClassOrNamespaceBinding
(
const
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
)
{
if
(
id
->
isEqualTo
(
identifier
()))
return
this
;
...
...
@@ -461,7 +461,7 @@ ClassBinding *ClassBinding::findClassBinding(Name *name, QSet<Binding *> *proces
Binding
*
currentBinding
=
this
;
for
(
unsigned
i
=
0
;
i
<
q
->
nameCount
()
-
1
;
++
i
)
{
Identifier
*
id
=
q
->
nameAt
(
i
)
->
identifier
();
const
Identifier
*
id
=
q
->
nameAt
(
i
)
->
identifier
();
if
(
!
id
)
return
0
;
...
...
@@ -479,12 +479,12 @@ ClassBinding *ClassBinding::findClassBinding(Name *name, QSet<Binding *> *proces
return
0
;
}
if
(
Identifier
*
id
=
name
->
identifier
())
{
if
(
const
Identifier
*
id
=
name
->
identifier
())
{
if
(
id
->
isEqualTo
(
identifier
()))
return
this
;
foreach
(
ClassBinding
*
nestedClassBinding
,
children
)
{
if
(
Identifier
*
nestedClassId
=
nestedClassBinding
->
identifier
())
{
if
(
const
Identifier
*
nestedClassId
=
nestedClassBinding
->
identifier
())
{
if
(
nestedClassId
->
isEqualTo
(
id
))
return
nestedClassBinding
;
}
...
...
@@ -557,7 +557,7 @@ Name *ClassBinding::name() const
return
symbols
.
first
()
->
name
();
}
Identifier
*
ClassBinding
::
identifier
()
const
const
Identifier
*
ClassBinding
::
identifier
()
const
{
if
(
Name
*
n
=
name
())
return
n
->
identifier
();
...
...
src/libs/cplusplus/CppBindings.h
View file @
fade61a8
...
...
@@ -53,7 +53,7 @@ class CPLUSPLUS_EXPORT Location
public:
Location
();
Location
(
Symbol
*
symbol
);
Location
(
StringLiteral
*
fileId
,
unsigned
sourceLocation
);
Location
(
const
StringLiteral
*
fileId
,
unsigned
sourceLocation
);
inline
bool
isValid
()
const
{
return
_fileId
!=
0
;
}
...
...
@@ -61,14 +61,14 @@ public:
inline
operator
bool
()
const
{
return
_fileId
!=
0
;
}
inline
StringLiteral
*
fileId
()
const
inline
const
StringLiteral
*
fileId
()
const
{
return
_fileId
;
}
inline
unsigned
sourceLocation
()
const
{
return
_sourceLocation
;
}
private:
StringLiteral
*
_fileId
;
const
StringLiteral
*
_fileId
;
unsigned
_sourceLocation
;
};
...
...
@@ -85,7 +85,7 @@ public:
virtual
ClassBinding
*
asClassBinding
()
{
return
0
;
}
virtual
ClassBinding
*
findClassBinding
(
Name
*
name
,
QSet
<
Binding
*>
*
processed
)
=
0
;
virtual
Binding
*
findClassOrNamespaceBinding
(
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
)
=
0
;
virtual
Binding
*
findClassOrNamespaceBinding
(
const
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
)
=
0
;
};
class
CPLUSPLUS_EXPORT
NamespaceBinding
:
public
Binding
...
...
@@ -101,7 +101,7 @@ public:
NameId
*
name
()
const
;
/// Returns this binding's identifier.
Identifier
*
identifier
()
const
;
const
Identifier
*
identifier
()
const
;
/// Returns the binding for the global namespace (aka ::).
NamespaceBinding
*
globalNamespaceBinding
();
...
...
@@ -117,7 +117,7 @@ public:
bool
lookAtParent
=
true
);
virtual
ClassBinding
*
findClassBinding
(
Name
*
name
,
QSet
<
Binding
*>
*
processed
);
virtual
Binding
*
findClassOrNamespaceBinding
(
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
);
virtual
Binding
*
findClassOrNamespaceBinding
(
const
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
);
/// Helpers.
virtual
QByteArray
qualifiedId
()
const
;
...
...
@@ -168,11 +168,11 @@ public:
Name
*
name
()
const
;
/// Returns this binding's identifier.
Identifier
*
identifier
()
const
;
const
Identifier
*
identifier
()
const
;
virtual
QByteArray
qualifiedId
()
const
;
virtual
ClassBinding
*
findClassBinding
(
Name
*
name
,
QSet
<
Binding
*>
*
processed
);
virtual
Binding
*
findClassOrNamespaceBinding
(
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
);
virtual
Binding
*
findClassOrNamespaceBinding
(
const
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
);
void
dump
();
...
...
src/libs/cplusplus/CppDocument.cpp
View file @
fade61a8
...
...
@@ -66,7 +66,7 @@ public:
{
}
virtual
void
report
(
int
level
,
StringLiteral
*
fileId
,
const
StringLiteral
*
fileId
,
unsigned
line
,
unsigned
column
,
const
char
*
format
,
va_list
ap
)
{
...
...
@@ -118,8 +118,8 @@ Document::Document(const QString &fileName)
_control
->
setDiagnosticClient
(
new
DocumentDiagnosticClient
(
this
,
&
_diagnosticMessages
));
const
QByteArray
localFileName
=
fileName
.
toUtf8
();
StringLiteral
*
fileId
=
_control
->
findOrInsertStringLiteral
(
localFileName
.
constData
(),
localFileName
.
size
());
const
StringLiteral
*
fileId
=
_control
->
findOrInsertStringLiteral
(
localFileName
.
constData
(),
localFileName
.
size
());
_translationUnit
=
new
TranslationUnit
(
_control
,
fileId
);
_translationUnit
->
setQtMocRunEnabled
(
true
);
_translationUnit
->
setObjCEnabled
(
true
);
...
...
src/libs/cplusplus/FindUsages.cpp
View file @
fade61a8
...
...
@@ -57,7 +57,7 @@ void FindUsages::setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBi
_globalNamespaceBinding
=
globalNamespaceBinding
;
}
QList
<
int
>
FindUsages
::
operator
()(
Symbol
*
symbol
,
Identifier
*
id
,
AST
*
ast
)
QList
<
int
>
FindUsages
::
operator
()(
Symbol
*
symbol
,
const
Identifier
*
id
,
AST
*
ast
)
{
_processed
.
clear
();
_references
.
clear
();
...
...
@@ -344,7 +344,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
bool
FindUsages
::
visit
(
EnumeratorAST
*
ast
)
{
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
const
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
if
(
id
==
_id
)
{
LookupContext
context
=
currentContext
(
ast
);
const
QList
<
Symbol
*>
candidates
=
context
.
resolve
(
control
()
->
nameId
(
id
));
...
...
@@ -358,7 +358,7 @@ bool FindUsages::visit(EnumeratorAST *ast)
bool
FindUsages
::
visit
(
SimpleNameAST
*
ast
)
{
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
const
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
if
(
id
==
_id
)
{
LookupContext
context
=
currentContext
(
ast
);
const
QList
<
Symbol
*>
candidates
=
context
.
resolve
(
ast
->
name
);
...
...
@@ -370,7 +370,7 @@ bool FindUsages::visit(SimpleNameAST *ast)
bool
FindUsages
::
visit
(
DestructorNameAST
*
ast
)
{
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
const
Identifier
*
id
=
identifier
(
ast
->
identifier_token
);
if
(
id
==
_id
)
{
LookupContext
context
=
currentContext
(
ast
);
const
QList
<
Symbol
*>
candidates
=
context
.
resolve
(
ast
->
name
);
...
...
src/libs/cplusplus/FindUsages.h
View file @
fade61a8
...
...
@@ -64,7 +64,7 @@ public:
void
setGlobalNamespaceBinding
(
NamespaceBindingPtr
globalNamespaceBinding
);
QList
<
int
>
operator
()(
Symbol
*
symbol
,
Identifier
*
id
,
AST
*
ast
);
QList
<
int
>
operator
()(
Symbol
*
symbol
,
const
Identifier
*
id
,
AST
*
ast
);
protected:
using
ASTVisitor
::
visit
;
...
...
@@ -101,7 +101,7 @@ protected:
private:
QFutureInterface
<
Usage
>
*
_future
;
Identifier
*
_id
;
const
Identifier
*
_id
;
Symbol
*
_declSymbol
;
Document
::
Ptr
_doc
;
Snapshot
_snapshot
;
...
...
src/libs/cplusplus/GenTemplateInstance.cpp
View file @
fade61a8
...
...
@@ -55,7 +55,7 @@ public:
FullySpecifiedType
apply
(
Name
*
name
);
FullySpecifiedType
apply
(
const
FullySpecifiedType
&
type
);
int
findSubstitution
(
Identifier
*
id
)
const
;
int
findSubstitution
(
const
Identifier
*
id
)
const
;
FullySpecifiedType
applySubstitution
(
int
index
)
const
;
private:
...
...
@@ -218,7 +218,7 @@ private:
Control
*
control
()
const
{
return
q
->
control
();
}
int
findSubstitution
(
Identifier
*
id
)
const
int
findSubstitution
(
const
Identifier
*
id
)
const
{
return
q
->
findSubstitution
(
id
);
}
FullySpecifiedType
applySubstitution
(
int
index
)
const
...
...
@@ -337,12 +337,12 @@ FullySpecifiedType ApplySubstitution::apply(const FullySpecifiedType &type)
return
ty
;
}
int
ApplySubstitution
::
findSubstitution
(
Identifier
*
id
)
const
int
ApplySubstitution
::
findSubstitution
(
const
Identifier
*
id
)
const
{
Q_ASSERT
(
id
!=
0
);
for
(
int
index
=
0
;
index
<
substitution
.
size
();
++
index
)
{
QPair
<
Identifier
*
,
FullySpecifiedType
>
s
=
substitution
.
at
(
index
);
QPair
<
const
Identifier
*
,
FullySpecifiedType
>
s
=
substitution
.
at
(
index
);
if
(
id
->
isEqualTo
(
s
.
first
))
return
index
;
...
...
src/libs/cplusplus/GenTemplateInstance.h
View file @
fade61a8
...
...
@@ -44,7 +44,7 @@ namespace CPlusPlus {
class
CPLUSPLUS_EXPORT
GenTemplateInstance
{
public:
typedef
QList
<
QPair
<
Identifier
*
,
FullySpecifiedType
>
>
Substitution
;
typedef
QList
<
QPair
<
const
Identifier
*
,
FullySpecifiedType
>
>
Substitution
;
public:
GenTemplateInstance
(
const
LookupContext
&
context
,
const
Substitution
&
substitution
);
...
...
src/libs/cplusplus/LookupContext.cpp
View file @
fade61a8
...
...
@@ -240,7 +240,7 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
else
if
(
OperatorNameId
*
opId
=
name
->
asOperatorNameId
())
return
resolveOperatorNameId
(
opId
,
visibleScopes
,
mode
);
else
if
(
Identifier
*
id
=
name
->
identifier
())
{
else
if
(
const
Identifier
*
id
=
name
->
identifier
())
{
for
(
int
scopeIndex
=
0
;
scopeIndex
<
visibleScopes
.
size
();
++
scopeIndex
)
{
Scope
*
scope
=
visibleScopes
.
at
(
scopeIndex
);
...
...
@@ -251,7 +251,7 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
else
if
(
!
maybeValidSymbol
(
symbol
,
mode
,
candidates
))
continue
;
// skip it, we're not looking for this kind of symbols
else
if
(
Identifier
*
symbolId
=
symbol
->
identifier
())
{
else
if
(
const
Identifier
*
symbolId
=
symbol
->
identifier
())
{
if
(
!
symbolId
->
isEqualTo
(
id
))
continue
;
// skip it, the symbol's id is not compatible with this lookup.
}
...
...
@@ -265,7 +265,7 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
Name
*
classOrNamespaceName
=
control
()
->
qualifiedNameId
(
q
->
names
(),
q
->
nameCount
()
-
1
);
if
(
Identifier
*
classOrNamespaceNameId
=
identifier
(
classOrNamespaceName
))
{
if
(
const
Identifier
*
classOrNamespaceNameId
=
identifier
(
classOrNamespaceName
))
{
if
(
classOrNamespaceNameId
->
isEqualTo
(
id
))
continue
;
}
...
...
@@ -299,7 +299,7 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
return
candidates
;
}
Identifier
*
LookupContext
::
identifier
(
const
Name
*
name
)
const
const
Identifier
*
LookupContext
::
identifier
(
const
Name
*
name
)
const
{
if
(
name
)
return
name
->
identifier
();
...
...
@@ -667,7 +667,7 @@ Symbol *LookupContext::canonicalSymbol(Symbol *symbol,
if
(
!
canonicalSymbol
)
return
0
;
if
(
Identifier
*
symbolId
=
canonicalSymbol
->
identifier
())
{
if
(
const
Identifier
*
symbolId
=
canonicalSymbol
->
identifier
())
{
if
(
symbolId
&&
canonicalSymbol
->
type
()
->
isFunctionType
())
{
Class
*
enclosingClass
=
canonicalSymbol
->
scope
()
->
owner
()
->
asClass
();
const
QList
<
ClassBinding
*>
classBindings
=
visibleClassBindings
(
enclosingClass
,
globalNamespace
);
...
...
src/libs/cplusplus/LookupContext.h
View file @
fade61a8
...
...
@@ -198,7 +198,7 @@ private:
QList
<
Scope
*>
resolveNestedNameSpecifier
(
QualifiedNameId
*
q
,
const
QList
<
Scope
*>
&
visibleScopes
)
const
;
Identifier
*
identifier
(
const
Name
*
name
)
const
;
const
Identifier
*
identifier
(
const
Name
*
name
)
const
;
QList
<
Scope
*>
buildVisibleScopes
();
...
...
src/libs/cplusplus/NamePrettyPrinter.cpp
View file @
fade61a8
...
...
@@ -64,7 +64,7 @@ QString NamePrettyPrinter::switchName(const QString &name)
void
NamePrettyPrinter
::
visit
(
NameId
*
name
)
{
Identifier
*
id
=
name
->
identifier
();
const
Identifier
*
id
=
name
->
identifier
();
if
(
id
)
_name
=
QString
::
fromLatin1
(
id
->
chars
(),
id
->
size
());
else
...
...
@@ -73,7 +73,7 @@ void NamePrettyPrinter::visit(NameId *name)
void
NamePrettyPrinter
::
visit
(
TemplateNameId
*
name
)
{
Identifier
*
id
=
name
->
identifier
();
const
Identifier
*
id
=
name
->
identifier
();
if
(
id
)
_name
=
QString
::
fromLatin1
(
id
->
chars
(),
id
->
size
());
else
...
...
@@ -95,7 +95,7 @@ void NamePrettyPrinter::visit(TemplateNameId *name)
void
NamePrettyPrinter
::
visit
(
DestructorNameId
*
name
)
{
Identifier
*
id
=
name
->
identifier
();
const
Identifier
*
id
=
name
->
identifier
();
_name
+=
QLatin1Char
(
'~'
);
_name
+=
QString
::
fromLatin1
(
id
->
chars
(),
id
->
size
());
}
...
...
@@ -261,8 +261,7 @@ void NamePrettyPrinter::visit(SelectorNameId *name)
if
(
!
n
)
continue
;
Identifier
*
id
=
n
->
identifier
();
if
(
id
)
{
if
(
const
Identifier
*
id
=
n
->
identifier
())
{
_name
+=
QString
::
fromLatin1
(
id
->
chars
(),
id
->
size
());
if
(
name
->
hasArguments
()
||
name
->
nameCount
()
>
1
)
...
...
src/libs/cplusplus/ResolveExpression.cpp
View file @
fade61a8
...
...
@@ -226,7 +226,7 @@ bool ResolveExpression::visit(SizeofExpressionAST *)
bool
ResolveExpression
::
visit
(
NumericLiteralAST
*
ast
)
{
Type
*
type
=
0
;
NumericLiteral
*
literal
=
numericLiteral
(
ast
->
literal_token
);
const
NumericLiteral
*
literal
=
numericLiteral
(
ast
->
literal_token
);
if
(
literal
->
isChar
())
type
=
control
()
->
integerType
(
IntegerType
::
Char
);
...
...
@@ -723,7 +723,7 @@ ResolveExpression::resolveMember(Name *memberName, Class *klass,
if
(
i
<
klass
->
templateParameterCount
())
{
Name
*
templArgName
=
klass
->
templateParameterAt
(
i
)
->
name
();
if
(
templArgName
&&
templArgName
->
identifier
())
{
Identifier
*
templArgId
=
templArgName
->
identifier
();
const
Identifier
*
templArgId
=
templArgName
->
identifier
();
subst
.
append
(
qMakePair
(
templArgId
,
templArgTy
));
}
}
...
...
src/plugins/cppeditor/cppeditor.cpp
View file @
fade61a8
...
...
@@ -219,7 +219,7 @@ protected:
if
(
!
(
ast
&&
ast
->
name
))
return
false
;
Identifier
*
id
=
ast
->
name
->
identifier
();
const
Identifier
*
id
=
ast
->
name
->
identifier
();
if
(
scope
)
{
for
(
Symbol
*
member
=
scope
->
lookat
(
id
);
member
;
member
=
member
->
next
())
{
...
...
@@ -1701,9 +1701,9 @@ void CPPEditor::performQuickFix(int index)
{
CPPQuickFixCollector
*
quickFixCollector
=
CppPlugin
::
instance
()
->
quickFixCollector
();
QuickFixOperationPtr
op
=
m_quickFixes
.
at
(
index
);
//
quickFixCollector->perform(op);
op
->
createChangeSet
();
setChangeSet
(
op
->
changeSet
());
quickFixCollector
->
perform
(
op
);
//
op->createChangeSet();
//
setChangeSet(op->changeSet());
}
void
CPPEditor
::
contextMenuEvent
(
QContextMenuEvent
*
e
)
...
...
src/plugins/cppeditor/cpphoverhandler.cpp
View file @
fade61a8
...
...
@@ -162,7 +162,7 @@ static QString buildHelpId(Symbol *symbol, Name *name)
if
(
owner
&&
owner
->
name
()
&&
!
scope
->
isEnumScope
())
{
Name
*
name
=
owner
->
name
();
Identifier
*
id
=
0
;
const
Identifier
*
id
=
0
;
if
(
NameId
*
nameId
=
name
->
asNameId
())
id
=
nameId
->
identifier
();
...
...
@@ -341,7 +341,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
if
(
resolvedSymbol
&&
resolvedSymbol
->
scope
()
&&
resolvedSymbol
->
scope
()
->
isClassScope
())
{
Class
*
enclosingClass
=
resolvedSymbol
->
scope
()
->
owner
()
->
asClass
();
if
(
Identifier
*
id
=
enclosingClass
->
identifier
())
{
if
(
const
Identifier
*
id
=
enclosingClass
->
identifier
())
{
if
(
id
->
isEqualTo
(
resolvedSymbol
->
identifier
()))
resolvedSymbol
=
enclosingClass
;
}
...
...
src/plugins/cpptools/cppfindreferences.cpp
View file @
fade61a8
...
...
@@ -79,8 +79,8 @@ QList<int> CppFindReferences::references(Symbol *symbol,
Document
::
Ptr
doc
,
const
Snapshot
&
snapshot
)
const
{
Identifier
*
id
=
0
;
if
(
Identifier
*
symbolId
=
symbol
->
identifier
())
const
Identifier
*
id
=
0
;
if
(
const
Identifier
*
symbolId
=
symbol
->
identifier
())
id
=
doc
->
control
()
->
findIdentifier
(
symbolId
->
chars
(),
symbolId
->
size
());
QList
<
int
>
references
;
...
...
@@ -106,7 +106,7 @@ static void find_helper(QFutureInterface<Usage> &future,
QTime
tm
;
tm
.
start
();
Identifier
*
symbolId
=
symbol
->
identifier
();
const
Identifier
*
symbolId
=
symbol
->
identifier
();
Q_ASSERT
(
symbolId
!=
0
);
const
QString
sourceFile
=
QString
::
fromUtf8
(
symbol
->
fileName
(),
symbol
->
fileNameLength
());
...
...
@@ -142,7 +142,7 @@ static void find_helper(QFutureInterface<Usage> &future,
if
(
Document
::
Ptr
previousDoc
=
snapshot
.
value
(
fileName
))
{
Control
*
control
=
previousDoc
->
control
();
Identifier
*
id
=
control
->
findIdentifier
(
symbolId
->
chars
(),
symbolId
->
size
());
const
Identifier
*
id
=
control
->
findIdentifier
(
symbolId
->
chars
(),
symbolId
->
size
());
if
(
!
id
)
continue
;
// skip this document, it's not using symbolId.
}
...
...
@@ -164,7 +164,7 @@ static void find_helper(QFutureInterface<Usage> &future,
doc
->
tokenize
();
Control
*
control
=
doc
->
control
();
if
(
Identifier
*
id
=
control
->
findIdentifier
(
symbolId
->
chars
(),
symbolId
->
size
()))
{
if
(
const
Identifier
*
id
=
control
->
findIdentifier
(
symbolId
->
chars
(),
symbolId
->
size
()))
{
QTime
tm
;
tm
.
start
();