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
Tobias Hunger
qt-creator
Commits
def098bc
Commit
def098bc
authored
Jul 10, 2009
by
Roberto Raggi
Browse files
Return the right type for the literal.
parent
d685437d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/ResolveExpression.cpp
View file @
def098bc
...
...
@@ -343,9 +343,34 @@ bool ResolveExpression::visit(SizeofExpressionAST *)
return
false
;
}
bool
ResolveExpression
::
visit
(
NumericLiteralAST
*
)
{
FullySpecifiedType
ty
(
control
()
->
integerType
(
IntegerType
::
Int
));
bool
ResolveExpression
::
visit
(
NumericLiteralAST
*
ast
)
{
Type
*
type
=
0
;
NumericLiteral
*
literal
=
numericLiteral
(
ast
->
literal_token
);
if
(
literal
->
isChar
())
type
=
control
()
->
integerType
(
IntegerType
::
Char
);
else
if
(
literal
->
isWideChar
())
type
=
control
()
->
integerType
(
IntegerType
::
WideChar
);
else
if
(
literal
->
isInt
())
type
=
control
()
->
integerType
(
IntegerType
::
Int
);
else
if
(
literal
->
isLong
())
type
=
control
()
->
integerType
(
IntegerType
::
Long
);
else
if
(
literal
->
isLongLong
())
type
=
control
()
->
integerType
(
IntegerType
::
LongLong
);
else
if
(
literal
->
isFloat
())
type
=
control
()
->
floatType
(
FloatType
::
Float
);
else
if
(
literal
->
isDouble
())
type
=
control
()
->
floatType
(
FloatType
::
Double
);
else
if
(
literal
->
isLongDouble
())
type
=
control
()
->
floatType
(
FloatType
::
LongDouble
);
else
type
=
control
()
->
integerType
(
IntegerType
::
Int
);
FullySpecifiedType
ty
(
type
);
if
(
literal
->
isUnsigned
())
ty
.
setUnsigned
(
true
);
addResult
(
ty
);
return
false
;
}
...
...
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