Commit def098bc authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Return the right type for the literal.

parent d685437d
......@@ -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);
type = control()->integerType(IntegerType::Int);
FullySpecifiedType ty(type);
if (literal->isUnsigned())
return false;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment