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
Marco Bubke
flatpak-qt-creator
Commits
615381a5
Commit
615381a5
authored
Jul 16, 2010
by
Roberto Raggi
Browse files
Use addUsage() instead of addTypeUsage().
parent
5871f2bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppchecksymbols.cpp
View file @
615381a5
...
...
@@ -353,7 +353,7 @@ bool CheckSymbols::visit(NamespaceAST *ast)
unsigned
line
,
column
;
getTokenStartPosition
(
ast
->
identifier_token
,
&
line
,
&
column
);
Use
use
(
line
,
column
,
tok
.
length
());
add
Type
Usage
(
use
);
addUsage
(
use
);
}
}
...
...
@@ -409,7 +409,7 @@ void CheckSymbols::checkName(NameAST *ast)
if
(
_potentialTypes
.
contains
(
id
))
{
Scope
*
scope
=
findScope
(
ast
);
const
QList
<
LookupItem
>
candidates
=
_context
.
lookup
(
ast
->
name
,
scope
);
add
Type
Usage
(
candidates
,
ast
);
addUsage
(
candidates
,
ast
);
}
else
if
(
_potentialMembers
.
contains
(
id
))
{
Scope
*
scope
=
findScope
(
ast
);
const
QList
<
LookupItem
>
candidates
=
_context
.
lookup
(
ast
->
name
,
scope
);
...
...
@@ -470,7 +470,7 @@ bool CheckSymbols::visit(QualifiedNameAST *ast)
const
Name
*
name
=
class_or_namespace_name
->
name
;
b
=
_context
.
lookupType
(
name
,
scope
);
add
Type
Usage
(
b
,
class_or_namespace_name
);
addUsage
(
b
,
class_or_namespace_name
);
for
(
it
=
it
->
next
;
b
&&
it
;
it
=
it
->
next
)
{
NestedNameSpecifierAST
*
nested_name_specifier
=
it
->
value
;
...
...
@@ -480,14 +480,14 @@ bool CheckSymbols::visit(QualifiedNameAST *ast)
accept
(
template_id
->
template_argument_list
);
b
=
b
->
findType
(
class_or_namespace_name
->
name
);
add
Type
Usage
(
b
,
class_or_namespace_name
);
addUsage
(
b
,
class_or_namespace_name
);
}
}
}
}
if
(
b
&&
ast
->
unqualified_name
)
add
Type
Usage
(
b
->
find
(
ast
->
unqualified_name
->
name
),
ast
->
unqualified_name
);
addUsage
(
b
->
find
(
ast
->
unqualified_name
->
name
),
ast
->
unqualified_name
);
}
return
false
;
...
...
@@ -501,7 +501,7 @@ bool CheckSymbols::visit(TypenameTypeParameterAST *ast)
if
(
_potentialTypes
.
contains
(
id
))
{
Scope
*
scope
=
findScope
(
_templateDeclarationStack
.
back
());
const
QList
<
LookupItem
>
candidates
=
_context
.
lookup
(
ast
->
name
->
name
,
scope
);
add
Type
Usage
(
candidates
,
ast
->
name
);
addUsage
(
candidates
,
ast
->
name
);
}
}
}
...
...
@@ -538,7 +538,7 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast)
QList
<
SemanticInfo
::
Use
>
uses
;
foreach
(
uses
,
locals
.
uses
)
{
foreach
(
const
SemanticInfo
::
Use
&
u
,
uses
)
add
Type
Usage
(
u
);
addUsage
(
u
);
}
_functionDefinitionStack
.
removeLast
();
...
...
@@ -547,10 +547,10 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast)
return
false
;
}
void
CheckSymbols
::
add
Type
Usage
(
const
Use
&
use
)
void
CheckSymbols
::
addUsage
(
const
Use
&
use
)
{
if
(
_functionDefinitionStack
.
isEmpty
())
{
if
(
_
typeU
sages
.
size
()
>=
50
)
{
if
(
_
u
sages
.
size
()
>=
50
)
{
if
(
_flushRequested
&&
use
.
line
!=
_flushLine
)
flush
();
else
if
(
!
_flushRequested
)
{
...
...
@@ -560,10 +560,10 @@ void CheckSymbols::addTypeUsage(const Use &use)
}
}
_
typeU
sages
.
append
(
use
);
_
u
sages
.
append
(
use
);
}
void
CheckSymbols
::
add
Type
Usage
(
ClassOrNamespace
*
b
,
NameAST
*
ast
)
void
CheckSymbols
::
addUsage
(
ClassOrNamespace
*
b
,
NameAST
*
ast
)
{
if
(
!
b
)
return
;
...
...
@@ -580,11 +580,11 @@ void CheckSymbols::addTypeUsage(ClassOrNamespace *b, NameAST *ast)
getTokenStartPosition
(
startToken
,
&
line
,
&
column
);
const
unsigned
length
=
tok
.
length
();
const
Use
use
(
line
,
column
,
length
);
add
Type
Usage
(
use
);
addUsage
(
use
);
//qDebug() << "added use" << oo(ast->name) << line << column << length;
}
void
CheckSymbols
::
add
Type
Usage
(
const
QList
<
LookupItem
>
&
candidates
,
NameAST
*
ast
)
void
CheckSymbols
::
addUsage
(
const
QList
<
LookupItem
>
&
candidates
,
NameAST
*
ast
)
{
unsigned
startToken
=
ast
->
firstToken
();
if
(
DestructorNameAST
*
dtor
=
ast
->
asDestructorName
())
...
...
@@ -608,7 +608,7 @@ void CheckSymbols::addTypeUsage(const QList<LookupItem> &candidates, NameAST *as
c
->
isClass
()
||
c
->
isEnum
()
||
c
->
isForwardClassDeclaration
()
||
c
->
isTypenameArgument
())
{
const
Use
use
(
line
,
column
,
length
);
add
Type
Usage
(
use
);
addUsage
(
use
);
//qDebug() << "added use" << oo(ast->name) << line << column << length;
break
;
}
...
...
@@ -643,7 +643,7 @@ void CheckSymbols::addMemberUsage(const QList<LookupItem> &candidates, NameAST *
continue
;
const
Use
use
(
line
,
column
,
length
,
Use
::
Field
);
add
Type
Usage
(
use
);
addUsage
(
use
);
//qDebug() << "added use" << oo(ast->name) << line << column << length;
}
}
...
...
@@ -684,9 +684,9 @@ void CheckSymbols::flush()
_flushRequested
=
false
;
_flushLine
=
0
;
if
(
_
typeU
sages
.
isEmpty
())
if
(
_
u
sages
.
isEmpty
())
return
;
reportResults
(
_
typeU
sages
);
_
typeU
sages
.
clear
();
reportResults
(
_
u
sages
);
_
u
sages
.
clear
();
}
src/plugins/cppeditor/cppchecksymbols.h
View file @
615381a5
...
...
@@ -83,9 +83,9 @@ protected:
void
checkName
(
NameAST
*
ast
);
void
checkNamespace
(
NameAST
*
name
);
void
add
Type
Usage
(
ClassOrNamespace
*
b
,
NameAST
*
ast
);
void
add
Type
Usage
(
const
QList
<
LookupItem
>
&
candidates
,
NameAST
*
ast
);
void
add
Type
Usage
(
const
Use
&
use
);
void
addUsage
(
ClassOrNamespace
*
b
,
NameAST
*
ast
);
void
addUsage
(
const
QList
<
LookupItem
>
&
candidates
,
NameAST
*
ast
);
void
addUsage
(
const
Use
&
use
);
void
checkMemberName
(
NameAST
*
ast
);
void
addMemberUsage
(
const
QList
<
LookupItem
>
&
candidates
,
NameAST
*
ast
);
...
...
@@ -126,7 +126,7 @@ private:
QList
<
ScopedSymbol
*>
_scopes
;
QList
<
TemplateDeclarationAST
*>
_templateDeclarationStack
;
QList
<
FunctionDefinitionAST
*>
_functionDefinitionStack
;
QVector
<
Use
>
_
typeU
sages
;
QVector
<
Use
>
_
u
sages
;
bool
_flushRequested
;
unsigned
_flushLine
;
};
...
...
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