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
9a8e724f
Commit
9a8e724f
authored
Jun 18, 2009
by
Roberto Raggi
Browse files
Don't search for undefined symbols in ambiguous typeof expressions.
parent
44aa96fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppmodelmanager.cpp
View file @
9a8e724f
...
...
@@ -552,6 +552,24 @@ protected:
return
true
;
}
virtual
bool
visit
(
SizeofExpressionAST
*
ast
)
{
if
(
ast
->
lparen_token
&&
ast
->
expression
&&
ast
->
rparen_token
)
{
if
(
TypeIdAST
*
type_id
=
ast
->
expression
->
asTypeId
())
{
SpecifierAST
*
type_specifier
=
type_id
->
type_specifier
;
if
(
!
type_id
->
declarator
&&
type_specifier
&&
!
type_specifier
->
next
&&
type_specifier
->
asNamedTypeSpecifier
())
{
// this sizeof expression is ambiguos, e.g.
// sizeof (a)
// `a' can be a typeid or a nested-expression.
return
false
;
}
}
}
return
true
;
}
LookupContext
lookupContext
(
unsigned
line
,
unsigned
column
)
const
;
private:
...
...
src/shared/cplusplus/AST.h
View file @
9a8e724f
...
...
@@ -1980,7 +1980,9 @@ class CPLUSPLUS_EXPORT SizeofExpressionAST: public ExpressionAST
{
public:
unsigned
sizeof_token
;
unsigned
lparen_token
;
ExpressionAST
*
expression
;
unsigned
rparen_token
;
public:
virtual
SizeofExpressionAST
*
asSizeofExpression
()
...
...
src/shared/cplusplus/Parser.cpp
View file @
9a8e724f
...
...
@@ -3158,7 +3158,8 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
if
(
LA
()
==
T_LPAREN
)
{
unsigned
lparen_token
=
consumeToken
();
if
(
parseTypeId
(
ast
->
expression
)
&&
LA
()
==
T_RPAREN
)
{
consumeToken
();
ast
->
lparen_token
=
lparen_token
;
ast
->
rparen_token
=
consumeToken
();
node
=
ast
;
return
true
;
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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