Fix char literal types in C
L'x' is actually wchar_t support C11 u and U char literals llvm-svn: 148390
This commit is contained in:
parent
8b2b677f39
commit
02f8605974
|
@ -2569,16 +2569,14 @@ ExprResult Sema::ActOnCharacterConstant(const Token &Tok) {
|
||||||
return ExprError();
|
return ExprError();
|
||||||
|
|
||||||
QualType Ty;
|
QualType Ty;
|
||||||
if (!getLangOptions().CPlusPlus)
|
if (Literal.isWide())
|
||||||
Ty = Context.IntTy; // 'x' and L'x' -> int in C.
|
Ty = Context.WCharTy; // L'x' -> wchar_t in C and C++.
|
||||||
else if (Literal.isWide())
|
|
||||||
Ty = Context.WCharTy; // L'x' -> wchar_t in C++.
|
|
||||||
else if (Literal.isUTF16())
|
else if (Literal.isUTF16())
|
||||||
Ty = Context.Char16Ty; // u'x' -> char16_t in C++0x.
|
Ty = Context.Char16Ty; // u'x' -> char16_t in C11 and C++11.
|
||||||
else if (Literal.isUTF32())
|
else if (Literal.isUTF32())
|
||||||
Ty = Context.Char32Ty; // U'x' -> char32_t in C++0x.
|
Ty = Context.Char32Ty; // U'x' -> char32_t in C11 and C++11.
|
||||||
else if (Literal.isMultiChar())
|
else if (!getLangOptions().CPlusPlus || Literal.isMultiChar())
|
||||||
Ty = Context.IntTy; // 'wxyz' -> int in C++.
|
Ty = Context.IntTy; // 'x' -> int in C, 'wxyz' -> int in C++.
|
||||||
else
|
else
|
||||||
Ty = Context.CharTy; // 'x' -> char in C++
|
Ty = Context.CharTy; // 'x' -> char in C++
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue