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
273a64bb
Commit
273a64bb
authored
Mar 19, 2010
by
Roberto Raggi
Browse files
Fixed possible leaks when processing friend template classes and template constructors.
parent
d20fd0c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/CheckDeclaration.cpp
View file @
273a64bb
...
...
@@ -144,16 +144,20 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
if
(
_templateParameters
&&
ty
)
{
if
(
Class
*
klass
=
ty
->
asClassType
())
{
klass
->
setTemplateParameters
(
_templateParameters
);
_templateParameters
=
0
;
// consume the template parameters
}
}
if
(
!
ast
->
declarator_list
&&
ast
->
decl_specifier_list
&&
!
ast
->
decl
_specifier_list
->
nex
t
)
{
if
(
ElaboratedTypeSpecifierAST
*
elab_type_spec
=
ast
->
decl_specifier_list
->
value
->
asElaboratedTypeSpecifier
()
)
{
if
(
ast
->
decl_specifier_list
&&
!
ast
->
decl
arator_lis
t
)
{
ElaboratedTypeSpecifierAST
*
elab_type_spec
=
ast
->
decl_specifier_list
->
value
->
asElaboratedTypeSpecifier
()
;
unsigned
sourceLocation
=
elab_type_spec
->
firstToken
();
if
(
!
elab_type_spec
&&
ty
.
isFriend
()
&&
ast
->
decl_specifier_list
->
next
&&
!
ast
->
decl_specifier_list
->
next
->
next
)
{
// friend template class
elab_type_spec
=
ast
->
decl_specifier_list
->
next
->
value
->
asElaboratedTypeSpecifier
();
}
if
(
elab_type_spec
->
name
)
sourceLocation
=
elab_type_spec
->
name
->
firstToken
();
if
(
elab_type_spec
)
{
unsigned
sourceLocation
=
ast
->
decl_specifier_list
->
firstToken
();
const
Name
*
name
=
semantic
()
->
check
(
elab_type_spec
->
name
,
_scope
);
ForwardClassDeclaration
*
symbol
=
...
...
@@ -210,11 +214,12 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
symbol
->
setStartOffset
(
tokenAt
(
ast
->
firstToken
()).
offset
);
symbol
->
setEndOffset
(
tokenAt
(
ast
->
lastToken
()).
offset
);
symbol
->
setType
(
control
()
->
integerType
(
IntegerType
::
Int
));
symbol
->
setType
(
declTy
);
if
(
_templateParameters
&&
it
==
ast
->
declarator_list
&&
ty
&&
!
ty
->
isClassType
())
if
(
_templateParameters
&&
it
==
ast
->
declarator_list
)
{
symbol
->
setTemplateParameters
(
_templateParameters
);
_templateParameters
=
0
;
// consume the template parameters
}
symbol
->
setVisibility
(
semantic
()
->
currentVisibility
());
...
...
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