Commit 2fd3c8bd authored by Joerg Bornemann's avatar Joerg Bornemann
Browse files

C++: fix ResolveExpression for string literals



ResolveExpression now correctly handles wide and
UTF-n string literals.

Change-Id: Ide2373ffdc4c9e1e4b53236a8e2782653d15e687
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 0d0606a6
......@@ -386,9 +386,25 @@ bool ResolveExpression::visit(NestedExpressionAST *ast)
return false;
}
bool ResolveExpression::visit(StringLiteralAST *)
bool ResolveExpression::visit(StringLiteralAST *ast)
{
FullySpecifiedType charTy = control()->integerType(IntegerType::Char);
const Token &tk = tokenAt(ast->literal_token);
int intId;
switch (tk.kind()) {
case T_WIDE_STRING_LITERAL:
intId = IntegerType::WideChar;
break;
case T_UTF16_STRING_LITERAL:
intId = IntegerType::Char16;
break;
case T_UTF32_STRING_LITERAL:
intId = IntegerType::Char32;
break;
default:
intId = IntegerType::Char;
break;
}
FullySpecifiedType charTy = control()->integerType(intId);
charTy.setConst(true);
FullySpecifiedType ty(control()->pointerType(charTy));
addResult(ty, _scope);
......
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