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
Marco Bubke
flatpak-qt-creator
Commits
7c7ce13a
Commit
7c7ce13a
authored
Dec 01, 2009
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use const names.
parent
f2e77fb8
Changes
46
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
577 additions
and
642 deletions
+577
-642
src/libs/cplusplus/CheckUndefinedSymbols.cpp
src/libs/cplusplus/CheckUndefinedSymbols.cpp
+8
-8
src/libs/cplusplus/CheckUndefinedSymbols.h
src/libs/cplusplus/CheckUndefinedSymbols.h
+2
-2
src/libs/cplusplus/CppBindings.cpp
src/libs/cplusplus/CppBindings.cpp
+22
-22
src/libs/cplusplus/CppBindings.h
src/libs/cplusplus/CppBindings.h
+9
-9
src/libs/cplusplus/GenTemplateInstance.cpp
src/libs/cplusplus/GenTemplateInstance.cpp
+17
-15
src/libs/cplusplus/LookupContext.cpp
src/libs/cplusplus/LookupContext.cpp
+20
-20
src/libs/cplusplus/LookupContext.h
src/libs/cplusplus/LookupContext.h
+15
-15
src/libs/cplusplus/NamePrettyPrinter.cpp
src/libs/cplusplus/NamePrettyPrinter.cpp
+9
-9
src/libs/cplusplus/NamePrettyPrinter.h
src/libs/cplusplus/NamePrettyPrinter.h
+8
-8
src/libs/cplusplus/Overview.cpp
src/libs/cplusplus/Overview.cpp
+2
-2
src/libs/cplusplus/Overview.h
src/libs/cplusplus/Overview.h
+4
-4
src/libs/cplusplus/ResolveExpression.cpp
src/libs/cplusplus/ResolveExpression.cpp
+22
-22
src/libs/cplusplus/ResolveExpression.h
src/libs/cplusplus/ResolveExpression.h
+7
-7
src/libs/cplusplus/TypePrettyPrinter.cpp
src/libs/cplusplus/TypePrettyPrinter.cpp
+1
-1
src/plugins/cppeditor/cppeditor.cpp
src/plugins/cppeditor/cppeditor.cpp
+24
-23
src/plugins/cppeditor/cpphoverhandler.cpp
src/plugins/cppeditor/cpphoverhandler.cpp
+6
-6
src/plugins/cpptools/cppcodecompletion.cpp
src/plugins/cpptools/cppcodecompletion.cpp
+11
-11
src/plugins/cpptools/searchsymbols.cpp
src/plugins/cpptools/searchsymbols.cpp
+2
-2
src/plugins/designer/qtcreatorintegration.cpp
src/plugins/designer/qtcreatorintegration.cpp
+12
-12
src/shared/cplusplus/AST.h
src/shared/cplusplus/AST.h
+2
-2
src/shared/cplusplus/CheckDeclaration.cpp
src/shared/cplusplus/CheckDeclaration.cpp
+19
-19
src/shared/cplusplus/CheckDeclarator.cpp
src/shared/cplusplus/CheckDeclarator.cpp
+6
-6
src/shared/cplusplus/CheckDeclarator.h
src/shared/cplusplus/CheckDeclarator.h
+3
-3
src/shared/cplusplus/CheckExpression.cpp
src/shared/cplusplus/CheckExpression.cpp
+3
-4
src/shared/cplusplus/CheckName.cpp
src/shared/cplusplus/CheckName.cpp
+16
-17
src/shared/cplusplus/CheckName.h
src/shared/cplusplus/CheckName.h
+5
-5
src/shared/cplusplus/CheckSpecifier.cpp
src/shared/cplusplus/CheckSpecifier.cpp
+6
-6
src/shared/cplusplus/CheckStatement.cpp
src/shared/cplusplus/CheckStatement.cpp
+6
-5
src/shared/cplusplus/Control.cpp
src/shared/cplusplus/Control.cpp
+83
-84
src/shared/cplusplus/Control.h
src/shared/cplusplus/Control.h
+33
-33
src/shared/cplusplus/CoreTypes.cpp
src/shared/cplusplus/CoreTypes.cpp
+8
-8
src/shared/cplusplus/CoreTypes.h
src/shared/cplusplus/CoreTypes.h
+6
-6
src/shared/cplusplus/Name.cpp
src/shared/cplusplus/Name.cpp
+2
-2
src/shared/cplusplus/Name.h
src/shared/cplusplus/Name.h
+3
-11
src/shared/cplusplus/NameVisitor.cpp
src/shared/cplusplus/NameVisitor.cpp
+1
-3
src/shared/cplusplus/NameVisitor.h
src/shared/cplusplus/NameVisitor.h
+10
-10
src/shared/cplusplus/Names.cpp
src/shared/cplusplus/Names.cpp
+36
-64
src/shared/cplusplus/Names.h
src/shared/cplusplus/Names.h
+17
-48
src/shared/cplusplus/Scope.cpp
src/shared/cplusplus/Scope.cpp
+10
-10
src/shared/cplusplus/Scope.h
src/shared/cplusplus/Scope.h
+1
-1
src/shared/cplusplus/Semantic.cpp
src/shared/cplusplus/Semantic.cpp
+4
-4
src/shared/cplusplus/Semantic.h
src/shared/cplusplus/Semantic.h
+4
-4
src/shared/cplusplus/Symbol.cpp
src/shared/cplusplus/Symbol.cpp
+24
-24
src/shared/cplusplus/Symbol.h
src/shared/cplusplus/Symbol.h
+5
-5
src/shared/cplusplus/Symbols.cpp
src/shared/cplusplus/Symbols.cpp
+35
-33
src/shared/cplusplus/Symbols.h
src/shared/cplusplus/Symbols.h
+28
-27
No files found.
src/libs/cplusplus/CheckUndefinedSymbols.cpp
View file @
7c7ce13a
...
...
@@ -122,7 +122,7 @@ bool CheckUndefinedSymbols::isType(const Identifier *id) const
return
isType
(
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
()));
}
void
CheckUndefinedSymbols
::
addType
(
Name
*
name
)
void
CheckUndefinedSymbols
::
addType
(
const
Name
*
name
)
{
if
(
!
name
)
return
;
...
...
@@ -131,7 +131,7 @@ void CheckUndefinedSymbols::addType(Name *name)
_types
.
insert
(
QByteArray
(
id
->
chars
(),
id
->
size
()));
}
void
CheckUndefinedSymbols
::
addProtocol
(
Name
*
name
)
void
CheckUndefinedSymbols
::
addProtocol
(
const
Name
*
name
)
{
if
(
!
name
)
return
;
...
...
@@ -294,7 +294,7 @@ bool CheckUndefinedSymbols::visit(ClassSpecifierAST *ast)
Symbol
*
symbol
=
klass
->
memberAt
(
i
);
if
(
symbol
->
name
()
&&
symbol
->
name
()
->
isNameId
())
{
NameId
*
nameId
=
symbol
->
name
()
->
asNameId
();
const
NameId
*
nameId
=
symbol
->
name
()
->
asNameId
();
if
(
!
qstrcmp
(
nameId
->
identifier
()
->
chars
(),
"qt_check_for_QOBJECT_macro"
))
{
hasQ_OBJECT_CHECK
=
true
;
...
...
@@ -367,7 +367,7 @@ bool CheckUndefinedSymbols::visit(BaseSpecifierAST *base)
if
(
NameAST
*
nameAST
=
base
->
name
)
{
bool
resolvedBaseClassName
=
false
;
if
(
Name
*
name
=
nameAST
->
name
)
{
if
(
const
Name
*
name
=
nameAST
->
name
)
{
const
Identifier
*
id
=
name
->
identifier
();
const
QByteArray
spell
=
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
());
if
(
isType
(
spell
))
...
...
@@ -403,9 +403,9 @@ bool CheckUndefinedSymbols::visit(UsingDirectiveAST *ast)
bool
CheckUndefinedSymbols
::
visit
(
QualifiedNameAST
*
ast
)
{
if
(
ast
->
name
)
{
QualifiedNameId
*
q
=
ast
->
name
->
asQualifiedNameId
();
const
QualifiedNameId
*
q
=
ast
->
name
->
asQualifiedNameId
();
for
(
unsigned
i
=
0
;
i
<
q
->
nameCount
()
-
1
;
++
i
)
{
Name
*
name
=
q
->
nameAt
(
i
);
const
Name
*
name
=
q
->
nameAt
(
i
);
if
(
const
Identifier
*
id
=
name
->
identifier
())
{
const
QByteArray
spell
=
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
());
if
(
!
(
_namespaceNames
.
contains
(
spell
)
||
isType
(
id
)))
{
...
...
@@ -474,7 +474,7 @@ bool CheckUndefinedSymbols::visit(ObjCClassDeclarationAST *ast)
if
(
NameAST
*
nameAST
=
ast
->
superclass
)
{
bool
resolvedSuperClassName
=
false
;
if
(
Name
*
name
=
nameAST
->
name
)
{
if
(
const
Name
*
name
=
nameAST
->
name
)
{
const
Identifier
*
id
=
name
->
identifier
();
const
QByteArray
spell
=
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
());
if
(
isType
(
spell
))
...
...
@@ -496,7 +496,7 @@ bool CheckUndefinedSymbols::visit(ObjCProtocolRefsAST *ast)
if
(
NameAST
*
nameAST
=
iter
->
value
)
{
bool
resolvedProtocolName
=
false
;
if
(
Name
*
name
=
nameAST
->
name
)
{
if
(
const
Name
*
name
=
nameAST
->
name
)
{
const
Identifier
*
id
=
name
->
identifier
();
const
QByteArray
spell
=
QByteArray
::
fromRawData
(
id
->
chars
(),
id
->
size
());
if
(
isProtocol
(
spell
))
...
...
src/libs/cplusplus/CheckUndefinedSymbols.h
View file @
7c7ce13a
...
...
@@ -55,11 +55,11 @@ protected:
bool
isType
(
const
Identifier
*
id
)
const
;
bool
isType
(
const
QByteArray
&
name
)
const
;
void
addType
(
Name
*
name
);
void
addType
(
const
Name
*
name
);
void
buildTypeMap
(
Class
*
klass
);
void
buildMemberTypeMap
(
Symbol
*
member
);
void
buildTypeMap
(
NamespaceBinding
*
binding
,
QSet
<
NamespaceBinding
*>
*
processed
);
void
addProtocol
(
Name
*
name
);
void
addProtocol
(
const
Name
*
name
);
bool
isProtocol
(
const
QByteArray
&
name
)
const
;
FunctionDeclaratorAST
*
currentFunctionDeclarator
()
const
;
...
...
src/libs/cplusplus/CppBindings.cpp
View file @
7c7ce13a
...
...
@@ -79,11 +79,11 @@ NamespaceBinding::~NamespaceBinding()
qDeleteAll
(
classBindings
);
}
NameId
*
NamespaceBinding
::
name
()
const
const
NameId
*
NamespaceBinding
::
name
()
const
{
if
(
symbols
.
size
())
{
if
(
Name
*
name
=
symbols
.
first
()
->
name
())
{
NameId
*
nameId
=
name
->
asNameId
();
if
(
const
Name
*
name
=
symbols
.
first
()
->
name
())
{
const
NameId
*
nameId
=
name
->
asNameId
();
Q_ASSERT
(
nameId
!=
0
);
return
nameId
;
...
...
@@ -95,7 +95,7 @@ NameId *NamespaceBinding::name() const
const
Identifier
*
NamespaceBinding
::
identifier
()
const
{
if
(
NameId
*
nameId
=
name
())
if
(
const
NameId
*
nameId
=
name
())
return
nameId
->
identifier
();
return
0
;
...
...
@@ -144,7 +144,7 @@ Binding *NamespaceBinding::findClassOrNamespaceBinding(const Identifier *id, QSe
return
0
;
}
ClassBinding
*
NamespaceBinding
::
findClassBinding
(
Name
*
name
,
QSet
<
Binding
*>
*
processed
)
ClassBinding
*
NamespaceBinding
::
findClassBinding
(
const
Name
*
name
,
QSet
<
Binding
*>
*
processed
)
{
if
(
!
name
)
return
0
;
...
...
@@ -191,19 +191,19 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
return
0
;
}
NamespaceBinding
*
NamespaceBinding
::
findNamespaceBinding
(
Name
*
name
)
NamespaceBinding
*
NamespaceBinding
::
findNamespaceBinding
(
const
Name
*
name
)
{
if
(
!
name
)
return
anonymousNamespaceBinding
;
else
if
(
NameId
*
nameId
=
name
->
asNameId
())
else
if
(
const
NameId
*
nameId
=
name
->
asNameId
())
return
findNamespaceBindingForNameId
(
nameId
,
/*lookAtParent = */
true
);
else
if
(
const
QualifiedNameId
*
q
=
name
->
asQualifiedNameId
())
{
NamespaceBinding
*
current
=
this
;
for
(
unsigned
i
=
0
;
i
<
q
->
nameCount
();
++
i
)
{
NameId
*
namespaceName
=
q
->
nameAt
(
i
)
->
asNameId
();
const
NameId
*
namespaceName
=
q
->
nameAt
(
i
)
->
asNameId
();
if
(
!
namespaceName
)
return
0
;
...
...
@@ -225,14 +225,14 @@ NamespaceBinding *NamespaceBinding::findNamespaceBinding(Name *name)
return
0
;
}
NamespaceBinding
*
NamespaceBinding
::
findNamespaceBindingForNameId
(
NameId
*
name
,
NamespaceBinding
*
NamespaceBinding
::
findNamespaceBindingForNameId
(
const
NameId
*
name
,
bool
lookAtParentNamespace
)
{
QSet
<
NamespaceBinding
*>
processed
;
return
findNamespaceBindingForNameId_helper
(
name
,
lookAtParentNamespace
,
&
processed
);
}
NamespaceBinding
*
NamespaceBinding
::
findNamespaceBindingForNameId_helper
(
NameId
*
name
,
NamespaceBinding
*
NamespaceBinding
::
findNamespaceBindingForNameId_helper
(
const
NameId
*
name
,
bool
lookAtParentNamespace
,
QSet
<
NamespaceBinding
*>
*
processed
)
{
...
...
@@ -242,12 +242,12 @@ NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId_helper(NameId
processed
->
insert
(
this
);
foreach
(
NamespaceBinding
*
binding
,
children
)
{
Name
*
bindingName
=
binding
->
name
();
const
Name
*
bindingName
=
binding
->
name
();
if
(
!
bindingName
)
continue
;
if
(
NameId
*
bindingNameId
=
bindingName
->
asNameId
())
{
if
(
const
NameId
*
bindingNameId
=
bindingName
->
asNameId
())
{
if
(
name
->
isEqualTo
(
bindingNameId
))
return
binding
;
}
...
...
@@ -296,7 +296,7 @@ NamespaceBinding *NamespaceBinding::findOrCreateNamespaceBinding(Namespace *symb
}
static
void
closure
(
const
Location
&
loc
,
NamespaceBinding
*
binding
,
Name
*
name
,
NamespaceBinding
*
binding
,
const
Name
*
name
,
QList
<
NamespaceBinding
*>
*
bindings
)
{
if
(
bindings
->
contains
(
binding
))
...
...
@@ -334,13 +334,13 @@ static void closure(const Location &loc,
NamespaceBinding
*
NamespaceBinding
::
resolveNamespace
(
const
Location
&
loc
,
Name
*
name
,
const
Name
*
name
,
bool
lookAtParent
)
{
if
(
!
name
)
return
0
;
else
if
(
NameId
*
nameId
=
name
->
asNameId
())
{
else
if
(
const
NameId
*
nameId
=
name
->
asNameId
())
{
QList
<
NamespaceBinding
*>
bindings
;
closure
(
loc
,
this
,
nameId
,
&
bindings
);
...
...
@@ -447,7 +447,7 @@ Binding *ClassBinding::findClassOrNamespaceBinding(const Identifier *id, QSet<Bi
return
0
;
}
ClassBinding
*
ClassBinding
::
findClassBinding
(
Name
*
name
,
QSet
<
Binding
*>
*
processed
)
ClassBinding
*
ClassBinding
::
findClassBinding
(
const
Name
*
name
,
QSet
<
Binding
*>
*
processed
)
{
if
(
!
name
)
return
0
;
...
...
@@ -549,7 +549,7 @@ ClassBinding::ClassBinding(ClassBinding *parentClass)
ClassBinding
::~
ClassBinding
()
{
qDeleteAll
(
children
);
}
Name
*
ClassBinding
::
name
()
const
const
Name
*
ClassBinding
::
name
()
const
{
if
(
symbols
.
isEmpty
())
return
0
;
...
...
@@ -559,7 +559,7 @@ Name *ClassBinding::name() const
const
Identifier
*
ClassBinding
::
identifier
()
const
{
if
(
Name
*
n
=
name
())
if
(
const
Name
*
n
=
name
())
return
n
->
identifier
();
return
0
;
...
...
@@ -623,12 +623,12 @@ protected:
NamespaceBinding
*
bind
(
Symbol
*
symbol
,
NamespaceBinding
*
binding
);
NamespaceBinding
*
findOrCreateNamespaceBinding
(
Namespace
*
symbol
);
NamespaceBinding
*
resolveNamespace
(
const
Location
&
loc
,
Name
*
name
);
NamespaceBinding
*
resolveNamespace
(
const
Location
&
loc
,
const
Name
*
name
);
NamespaceBinding
*
switchNamespaceBinding
(
NamespaceBinding
*
binding
);
ClassBinding
*
findOrCreateClassBinding
(
Class
*
classSymbol
);
ClassBinding
*
findClassBinding
(
Name
*
name
);
ClassBinding
*
findClassBinding
(
const
Name
*
name
);
ClassBinding
*
switchClassBinding
(
ClassBinding
*
binding
);
...
...
@@ -665,7 +665,7 @@ NamespaceBinding *Binder::bind(Symbol *symbol, NamespaceBinding *binding)
NamespaceBinding
*
Binder
::
findOrCreateNamespaceBinding
(
Namespace
*
symbol
)
{
return
namespaceBinding
->
findOrCreateNamespaceBinding
(
symbol
);
}
NamespaceBinding
*
Binder
::
resolveNamespace
(
const
Location
&
loc
,
Name
*
name
)
NamespaceBinding
*
Binder
::
resolveNamespace
(
const
Location
&
loc
,
const
Name
*
name
)
{
if
(
!
namespaceBinding
)
return
0
;
...
...
@@ -694,7 +694,7 @@ ClassBinding *Binder::findOrCreateClassBinding(Class *classSymbol)
return
binding
;
}
ClassBinding
*
Binder
::
findClassBinding
(
Name
*
name
)
ClassBinding
*
Binder
::
findClassBinding
(
const
Name
*
name
)
{
QSet
<
Binding
*>
processed
;
...
...
src/libs/cplusplus/CppBindings.h
View file @
7c7ce13a
...
...
@@ -84,7 +84,7 @@ public:
virtual
NamespaceBinding
*
asNamespaceBinding
()
{
return
0
;
}
virtual
ClassBinding
*
asClassBinding
()
{
return
0
;
}
virtual
ClassBinding
*
findClassBinding
(
Name
*
name
,
QSet
<
Binding
*>
*
processed
)
=
0
;
virtual
ClassBinding
*
findClassBinding
(
const
Name
*
name
,
QSet
<
Binding
*>
*
processed
)
=
0
;
virtual
Binding
*
findClassOrNamespaceBinding
(
const
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
)
=
0
;
};
...
...
@@ -98,7 +98,7 @@ public:
virtual
~
NamespaceBinding
();
/// Returns this binding's name.
NameId
*
name
()
const
;
const
NameId
*
name
()
const
;
/// Returns this binding's identifier.
const
Identifier
*
identifier
()
const
;
...
...
@@ -107,16 +107,16 @@ public:
NamespaceBinding
*
globalNamespaceBinding
();
/// Returns the binding for the given namespace symbol.
NamespaceBinding
*
findNamespaceBinding
(
Name
*
name
);
NamespaceBinding
*
findNamespaceBinding
(
const
Name
*
name
);
/// Returns the binding associated with the given symbol.
NamespaceBinding
*
findOrCreateNamespaceBinding
(
Namespace
*
symbol
);
NamespaceBinding
*
resolveNamespace
(
const
Location
&
loc
,
Name
*
name
,
const
Name
*
name
,
bool
lookAtParent
=
true
);
virtual
ClassBinding
*
findClassBinding
(
Name
*
name
,
QSet
<
Binding
*>
*
processed
);
virtual
ClassBinding
*
findClassBinding
(
const
Name
*
name
,
QSet
<
Binding
*>
*
processed
);
virtual
Binding
*
findClassOrNamespaceBinding
(
const
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
);
/// Helpers.
...
...
@@ -129,10 +129,10 @@ public:
static
ClassBinding
*
find
(
Class
*
symbol
,
NamespaceBinding
*
binding
);
private:
NamespaceBinding
*
findNamespaceBindingForNameId
(
NameId
*
name
,
NamespaceBinding
*
findNamespaceBindingForNameId
(
const
NameId
*
name
,
bool
lookAtParentNamespace
);
NamespaceBinding
*
findNamespaceBindingForNameId_helper
(
NameId
*
name
,
NamespaceBinding
*
findNamespaceBindingForNameId_helper
(
const
NameId
*
name
,
bool
lookAtParentNamespace
,
QSet
<
NamespaceBinding
*>
*
processed
);
...
...
@@ -165,13 +165,13 @@ public:
virtual
ClassBinding
*
asClassBinding
()
{
return
this
;
}
/// Returns this binding's name.
Name
*
name
()
const
;
const
Name
*
name
()
const
;
/// Returns this binding's identifier.
const
Identifier
*
identifier
()
const
;
virtual
QByteArray
qualifiedId
()
const
;
virtual
ClassBinding
*
findClassBinding
(
Name
*
name
,
QSet
<
Binding
*>
*
processed
);
virtual
ClassBinding
*
findClassBinding
(
const
Name
*
name
,
QSet
<
Binding
*>
*
processed
);
virtual
Binding
*
findClassOrNamespaceBinding
(
const
Identifier
*
id
,
QSet
<
Binding
*>
*
processed
);
void
dump
();
...
...
src/libs/cplusplus/GenTemplateInstance.cpp
View file @
7c7ce13a
...
...
@@ -52,7 +52,7 @@ public:
Control
*
control
()
const
{
return
context
.
control
();
}
FullySpecifiedType
apply
(
Name
*
name
);
FullySpecifiedType
apply
(
const
Name
*
name
);
FullySpecifiedType
apply
(
const
FullySpecifiedType
&
type
);
int
findSubstitution
(
const
Identifier
*
id
)
const
;
...
...
@@ -207,7 +207,7 @@ private:
public:
ApplyToName
(
ApplySubstitution
*
q
)
:
q
(
q
)
{}
FullySpecifiedType
operator
()(
Name
*
name
)
FullySpecifiedType
operator
()(
const
Name
*
name
)
{
FullySpecifiedType
previousType
=
switchType
(
FullySpecifiedType
());
accept
(
name
);
...
...
@@ -231,7 +231,7 @@ private:
return
previousType
;
}
virtual
void
visit
(
NameId
*
name
)
virtual
void
visit
(
const
NameId
*
name
)
{
int
index
=
findSubstitution
(
name
->
identifier
());
...
...
@@ -242,7 +242,7 @@ private:
_type
=
control
()
->
namedType
(
name
);
}
virtual
void
visit
(
TemplateNameId
*
name
)
virtual
void
visit
(
const
TemplateNameId
*
name
)
{
QVarLengthArray
<
FullySpecifiedType
,
8
>
arguments
(
name
->
templateArgumentCount
());
for
(
unsigned
i
=
0
;
i
<
name
->
templateArgumentCount
();
++
i
)
{
...
...
@@ -250,17 +250,19 @@ private:
arguments
[
i
]
=
q
->
apply
(
argTy
);
}
TemplateNameId
*
templId
=
control
()
->
templateNameId
(
name
->
identifier
(),
arguments
.
data
(),
arguments
.
size
());
const
TemplateNameId
*
templId
=
control
()
->
templateNameId
(
name
->
identifier
(),
arguments
.
data
(),
arguments
.
size
());
_type
=
control
()
->
namedType
(
templId
);
}
virtual
void
visit
(
QualifiedNameId
*
name
)
virtual
void
visit
(
const
QualifiedNameId
*
name
)
{
QVarLengthArray
<
Name
*
,
8
>
names
(
name
->
nameCount
());
QVarLengthArray
<
const
Name
*
,
8
>
names
(
name
->
nameCount
());
for
(
unsigned
i
=
0
;
i
<
name
->
nameCount
();
++
i
)
{
Name
*
n
=
name
->
nameAt
(
i
);
const
Name
*
n
=
name
->
nameAt
(
i
);
if
(
TemplateNameId
*
templId
=
n
->
asTemplateNameId
())
{
if
(
const
TemplateNameId
*
templId
=
n
->
asTemplateNameId
())
{
QVarLengthArray
<
FullySpecifiedType
,
8
>
arguments
(
templId
->
templateArgumentCount
());
for
(
unsigned
templateArgIndex
=
0
;
templateArgIndex
<
templId
->
templateArgumentCount
();
++
templateArgIndex
)
{
FullySpecifiedType
argTy
=
templId
->
templateArgumentAt
(
templateArgIndex
);
...
...
@@ -273,29 +275,29 @@ private:
names
[
i
]
=
n
;
}
QualifiedNameId
*
q
=
control
()
->
qualifiedNameId
(
names
.
data
(),
names
.
size
(),
name
->
isGlobal
());
const
QualifiedNameId
*
q
=
control
()
->
qualifiedNameId
(
names
.
data
(),
names
.
size
(),
name
->
isGlobal
());
_type
=
control
()
->
namedType
(
q
);
}
virtual
void
visit
(
DestructorNameId
*
name
)
virtual
void
visit
(
const
DestructorNameId
*
name
)
{
Overview
oo
;
qWarning
()
<<
"ignored name:"
<<
oo
(
name
);
}
virtual
void
visit
(
OperatorNameId
*
name
)
virtual
void
visit
(
const
OperatorNameId
*
name
)
{
Overview
oo
;
qWarning
()
<<
"ignored name:"
<<
oo
(
name
);
}
virtual
void
visit
(
ConversionNameId
*
name
)
virtual
void
visit
(
const
ConversionNameId
*
name
)
{
Overview
oo
;
qWarning
()
<<
"ignored name:"
<<
oo
(
name
);
}
virtual
void
visit
(
SelectorNameId
*
name
)
virtual
void
visit
(
const
SelectorNameId
*
name
)
{
Overview
oo
;
qWarning
()
<<
"ignored name:"
<<
oo
(
name
);
...
...
@@ -325,7 +327,7 @@ ApplySubstitution::~ApplySubstitution()
{
}
FullySpecifiedType
ApplySubstitution
::
apply
(
Name
*
name
)
FullySpecifiedType
ApplySubstitution
::
apply
(
const
Name
*
name
)
{
FullySpecifiedType
ty
=
applyToName
(
name
);
return
ty
;
...
...
src/libs/cplusplus/LookupContext.cpp
View file @
7c7ce13a
...
...
@@ -109,14 +109,14 @@ bool LookupContext::maybeValidSymbol(Symbol *symbol,
return
false
;
}
QList
<
Scope
*>
LookupContext
::
resolveNestedNameSpecifier
(
QualifiedNameId
*
q
,
const
QList
<
Scope
*>
&
visibleScopes
)
const
QList
<
Scope
*>
LookupContext
::
resolveNestedNameSpecifier
(
const
QualifiedNameId
*
q
,
const
QList
<
Scope
*>
&
visibleScopes
)
const
{
QList
<
Symbol
*>
candidates
;
QList
<
Scope
*>
scopes
=
visibleScopes
;
for
(
unsigned
i
=
0
;
i
<
q
->
nameCount
()
-
1
;
++
i
)
{
Name
*
name
=
q
->
nameAt
(
i
);
const
Name
*
name
=
q
->
nameAt
(
i
);
candidates
=
resolveClassOrNamespace
(
name
,
scopes
);
...
...
@@ -137,7 +137,7 @@ QList<Scope *> LookupContext::resolveNestedNameSpecifier(QualifiedNameId *q,
return
scopes
;
}
QList
<
Symbol
*>
LookupContext
::
resolveQualifiedNameId
(
QualifiedNameId
*
q
,
QList
<
Symbol
*>
LookupContext
::
resolveQualifiedNameId
(
const
QualifiedNameId
*
q
,
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
mode
)
const
{
...
...
@@ -153,7 +153,7 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
else
if
(
!
symbol
->
isClass
())
continue
;
QualifiedNameId
*
qq
=
symbol
->
name
()
->
asQualifiedNameId
();
const
QualifiedNameId
*
qq
=
symbol
->
name
()
->
asQualifiedNameId
();
if
(
!
qq
)
continue
;
...
...
@@ -167,8 +167,8 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
unsigned
j
=
0
;
for
(;
j
<
q
->
nameCount
();
++
j
)
{
Name
*
classOrNamespaceName1
=
q
->
nameAt
(
j
);
Name
*
classOrNamespaceName2
=
qq
->
nameAt
(
j
);
const
Name
*
classOrNamespaceName1
=
q
->
nameAt
(
j
);
const
Name
*
classOrNamespaceName2
=
qq
->
nameAt
(
j
);
if
(
!
classOrNamespaceName1
->
isEqualTo
(
classOrNamespaceName2
))
break
;
...
...
@@ -205,7 +205,7 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
return
candidates
;
}
QList
<
Symbol
*>
LookupContext
::
resolveOperatorNameId
(
OperatorNameId
*
opId
,
QList
<
Symbol
*>
LookupContext
::
resolveOperatorNameId
(
const
OperatorNameId
*
opId
,
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
)
const
{
...
...
@@ -226,7 +226,7 @@ QList<Symbol *> LookupContext::resolveOperatorNameId(OperatorNameId *opId,
return
candidates
;
}
QList
<
Symbol
*>
LookupContext
::
resolve
(
Name
*
name
,
const
QList
<
Scope
*>
&
visibleScopes
,
QList
<
Symbol
*>
LookupContext
::
resolve
(
const
Name
*
name
,
const
QList
<
Scope
*>
&
visibleScopes
,
ResolveMode
mode
)
const
{
QList
<
Symbol
*>
candidates
;
...
...
@@ -234,10 +234,10 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
if
(
!
name
)
return
candidates
;
// nothing to do, the symbol is anonymous.
else
if
(
QualifiedNameId
*
q
=
name
->
asQualifiedNameId
())
else
if
(
const
QualifiedNameId
*
q
=
name
->
asQualifiedNameId
())
return
resolveQualifiedNameId
(
q
,
visibleScopes
,
mode
);
else
if
(
OperatorNameId
*
opId
=
name
->
asOperatorNameId
())
else
if
(
const
OperatorNameId
*
opId
=
name
->
asOperatorNameId
())
return
resolveOperatorNameId
(
opId
,
visibleScopes
,
mode
);
else
if
(
const
Identifier
*
id
=
name
->
identifier
())
{
...
...
@@ -256,14 +256,14 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
continue
;
// skip it, the symbol's id is not compatible with this lookup.
}
if
(
QualifiedNameId
*
q
=
symbol
->
name
()
->
asQualifiedNameId
())
{
if
(
const
QualifiedNameId
*
q
=
symbol
->
name
()
->
asQualifiedNameId
())
{
if
(
name
->
isDestructorNameId
()
!=
q
->
unqualifiedNameId
()
->
isDestructorNameId
())
continue
;
else
if
(
q
->
nameCount
()
>
1
)
{
Name
*
classOrNamespaceName
=
control
()
->
qualifiedNameId
(
q
->
names
(),
q
->
nameCount
()
-
1
);
const
Name
*
classOrNamespaceName
=
control
()
->
qualifiedNameId
(
q
->
names
(),
q
->
nameCount
()
-
1
);
if
(
const
Identifier
*
classOrNamespaceNameId
=
identifier
(
classOrNamespaceName
))
{
if
(
classOrNamespaceNameId
->
isEqualTo
(
id
))
...
...
@@ -418,7 +418,7 @@ void LookupContext::expandNamespace(Namespace *ns,
if
(
Scope
*
encl
=
ns
->
enclosingNamespaceScope
())
expand
(
encl
,
visibleScopes
,
expandedScopes
);
if
(
Name
*
nsName
=
ns
->
name
())
{
if
(
const
Name
*
nsName
=
ns
->
name
())
{
const
QList
<
Symbol
*>
namespaceList
=
resolveNamespace
(
nsName
,
visibleScopes
);
foreach
(
Symbol
*
otherNs
,
namespaceList
)
{
if
(
otherNs
==
ns
)
...
...
@@ -478,7 +478,7 @@ void LookupContext::expandClass(Class *klass,
for
(
unsigned
i
=
0
;
i
<
klass
->
baseClassCount
();
++
i
)
{
BaseClass
*
baseClass
=
klass
->
baseClassAt
(
i
);
Name
*
baseClassName
=
baseClass
->
name
();
const
Name
*
baseClassName
=
baseClass
->
name
();
const
QList
<
Symbol
*>
baseClassCandidates
=
resolveClass
(
baseClassName
,
classVisibleScopes
);
...
...
@@ -515,8 +515,8 @@ void LookupContext::expandFunction(Function *function,
if
(
!
expandedScopes
->
contains
(
function
->
arguments
()))
expandedScopes
->
append
(
function
->
arguments
());
if
(
QualifiedNameId
*
q
=
function
->
name
()
->
asQualifiedNameId
())
{
Name
*
nestedNameSpec
=
0
;
if
(
const
QualifiedNameId
*
q
=
function
->
name
()
->
asQualifiedNameId
())
{
const
Name
*
nestedNameSpec
=
0
;
if
(
q
->
nameCount
()
==
1
)
nestedNameSpec
=
q
->
nameAt
(
0
);
else
...
...
@@ -565,7 +565,7 @@ void LookupContext::expandObjCClass(ObjCClass *klass,
// expand the base class:
if
(
ObjCBaseClass
*
baseClass
=
klass
->
baseClass
())
{
Name
*
baseClassName
=
baseClass
->
name
();
const
Name
*
baseClassName
=
baseClass
->
name
();
const
QList
<
Symbol
*>
baseClassCandidates
=
resolveObjCClass
(
baseClassName
,
visibleScopes
);
...
...
@@ -577,7 +577,7 @@ void LookupContext::expandObjCClass(ObjCClass *klass,
// expand the protocols:
for
(
unsigned
i
=
0
;
i
<
klass
->
protocolCount
();
++
i
)
{
Name
*
protocolName
=
klass
->
protocolAt
(
i
)
->
name
();
const
Name
*
protocolName
=
klass
->
protocolAt
(
i
)
->
name
();
const
QList
<
Symbol
*>
protocolCandidates
=
resolveObjCProtocol
(
protocolName
,
visibleScopes
);
for
(
int
j
=
0
;
j
<
protocolCandidates
.
size
();
++
j
)
{
if
(
ObjCProtocol
*
protocolSymbol
=
protocolCandidates
.
at
(
j
)
->
asObjCProtocol
())
...
...
src/libs/cplusplus/LookupContext.h
View file @
7c7ce13a
...
...
@@ -94,22 +94,22 @@ public:
static
Symbol
*
canonicalSymbol
(
const
QList
<
LookupItem
>
&
candidates
,
NamespaceBinding
*
globalNamespaceBinding
);
QList
<
Symbol
*>
resolve
(
Name
*
name
)
const
QList
<
Symbol
*>
resolve
(
const
Name
*
name
)
const
{
return
resolve
(
name
,
visibleScopes
());
}
QList
<
Symbol
*>
resolveNamespace
(
Name
*
name
)
const
QList
<
Symbol
*>
resolveNamespace
(
const
Name
*
name
)
const
{
return
resolveNamespace
(
name
,
visibleScopes
());
}
QList
<
Symbol
*>
resolveClass
(
Name
*
name
)
const
QList
<
Symbol
*>
resolveClass
(
const
Name
*
name
)
const
{
return
resolveClass
(
name
,
visibleScopes
());
}
QList
<
Symbol
*>
resolveClassOrNamespace
(
Name
*
name
)
const
QList
<
Symbol
*>
resolveClassOrNamespace
(
const
Name
*
name
)
const
{
return
resolveClassOrNamespace
(
name
,
visibleScopes
());
}
QList
<
Symbol
*>
resolveObjCClass
(
Name
*
name
)
const
QList
<
Symbol
*>
resolveObjCClass
(
const
Name
*
name
)
const
{
return
resolveObjCClass
(
name
,
visibleScopes
());
}
QList
<
Symbol
*>
resolveObjCProtocol
(
Name
*
name
)
const
QList
<
Symbol
*>
resolveObjCProtocol
(
const
Name
*
name
)
const
{
return
resolveObjCProtocol
(
name
,
visibleScopes
());
}
enum
ResolveMode
{
...
...
@@ -122,22 +122,22 @@ public:
ResolveAll
=
ResolveSymbol
|
ResolveClassOrNamespace
|
ResolveObjCClass
|
ResolveObjCProtocol
};