summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-06-21 12:39:25 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-06-21 12:39:25 +0000
commitd46e4a230344c78160f8c08431dfe19d3e6582ce (patch)
tree1084286869de3c535eca31387ecf1b3250b4236c /clang/lib/Sema/SemaExpr.cpp
parent8dd637aa04067837056633aedd3d15e0af4f2685 (diff)
downloadbcm5719-llvm-d46e4a230344c78160f8c08431dfe19d3e6582ce.tar.gz
bcm5719-llvm-d46e4a230344c78160f8c08431dfe19d3e6582ce.zip
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 llvm-svn: 211434
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 69cc8dc2fd1..2654c390ccf 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud