diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-21 12:39:25 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-21 12:39:25 +0000 |
commit | f533fd477a50467a0d96293d116f4059aa806b65 (patch) | |
tree | f8671d6df2189af0e1830c382f5cb7f0d7504ef4 /lib/Sema/SemaExpr.cpp | |
parent | d31bc8bc756b3734c79e3748627938ce25b8f30c (diff) | |
download | clang-f533fd477a50467a0d96293d116f4059aa806b65.tar.gz clang-f533fd477a50467a0d96293d116f4059aa806b65.tar.bz2 clang-f533fd477a50467a0d96293d116f4059aa806b65.tar.xz |
Revert "Lex: Use the correct types for MS integer suffixes"
This reverts commit r211426.
This broke the arm bots. The crash can be reproduced on X86 by running.
./bin/clang -cc1 -fsyntax-only -verify -fms-extensions ~/llvm/clang/test/Lexer/ms-extensions.c -triple arm-linux
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 69cc8dc2fd..2654c390cc 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3190,7 +3190,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { // may be wider than [u]intmax_t. // FIXME: Actually, they don't. We seem to have accidentally invented the // i128 suffix. - if (Literal.MicrosoftInteger && MaxWidth < 128 && + if (Literal.isMicrosoftInteger && MaxWidth < 128 && Context.getTargetInfo().hasInt128Type()) MaxWidth = 128; llvm::APInt ResultVal(MaxWidth, 0); @@ -3211,18 +3211,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { // Check from smallest to largest, picking the smallest type we can. unsigned Width = 0; - - // Microsoft specific integer suffixes are explicitly sized. - if (Literal.MicrosoftInteger) { - Width = Literal.MicrosoftInteger; - if (Width < 128) - Ty = Context.getIntTypeForBitwidth(Width, - /*Signed=*/!Literal.isUnsigned); - else - Ty = Literal.isUnsigned ? Context.UnsignedInt128Ty : Context.Int128Ty; - } - - if (Ty.isNull() && !Literal.isLong && !Literal.isLongLong) { + if (!Literal.isLong && !Literal.isLongLong) { // Are int/unsigned possibilities? unsigned IntSize = Context.getTargetInfo().getIntWidth(); @@ -3269,6 +3258,17 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { Width = LongLongSize; } } + + // If it doesn't fit in unsigned long long, and we're using Microsoft + // extensions, then its a 128-bit integer literal. + if (Ty.isNull() && Literal.isMicrosoftInteger && + Context.getTargetInfo().hasInt128Type()) { + if (Literal.isUnsigned) + Ty = Context.UnsignedInt128Ty; + else + Ty = Context.Int128Ty; + Width = 128; + } // If we still couldn't decide a type, we probably have something that // does not fit in a signed long long, but has no U suffix. |