aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/ResolveExpression.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <[email protected]>2010-07-01 15:27:03 +0200
committerRoberto Raggi <[email protected]>2010-07-01 15:27:36 +0200
commit0f2a24641b24baac119a693c77897222eed0c879 (patch)
tree4f4a5400a935e6f675ccc9458b565f3f1ab12f59 /src/libs/cplusplus/ResolveExpression.cpp
parent4be3333bf3b163d41e93a423af1a134935879c0a (diff)
Get rid of NumericLiteral::isChar/isWideChar().
Diffstat (limited to 'src/libs/cplusplus/ResolveExpression.cpp')
-rw-r--r--src/libs/cplusplus/ResolveExpression.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp
index 3f145979f3b..aadc1f5273a 100644
--- a/src/libs/cplusplus/ResolveExpression.cpp
+++ b/src/libs/cplusplus/ResolveExpression.cpp
@@ -254,32 +254,36 @@ bool ResolveExpression::visit(SizeofExpressionAST *)
bool ResolveExpression::visit(NumericLiteralAST *ast)
{
+ const Token &tk = tokenAt(ast->literal_token);
+
Type *type = 0;
- const NumericLiteral *literal = numericLiteral(ast->literal_token);
+ bool isUnsigned = false;
- if (literal->isChar())
+ if (tk.is(T_CHAR_LITERAL))
type = control()->integerType(IntegerType::Char);
- else if (literal->isWideChar())
+ else if (tk.is(T_WIDE_CHAR_LITERAL))
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);
+ else if (const NumericLiteral *literal = numericLiteral(ast->literal_token)) {
+ isUnsigned = literal->isUnsigned();
+
+ 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);
-
+ ty.setUnsigned(isUnsigned);
addResult(ty, _scope);
return false;
}