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
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 69cc8dc..2654c39 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -3190,7 +3190,7 @@
// 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 @@
// 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 @@
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.