[PATCH] Lex: Use the correct types for MS integer suffixes
Richard Smith
richard at metafoo.co.uk
Sun Jun 15 04:35:44 PDT 2014
================
Comment at: lib/AST/StmtPrinter.cpp:914
@@ -913,3 +913,3 @@
default: llvm_unreachable("Unexpected type for integer literal!");
// FIXME: The Short and UShort cases are to handle cases where a short
// integeral literal is formed during template instantiation. They should
----------------
This comment is out of date.
================
Comment at: lib/Sema/SemaExpr.cpp:3189
@@ -3188,3 +3188,3 @@
// i128 suffix.
- if (Literal.isMicrosoftInteger && MaxWidth < 128 &&
+ if (Literal.MicrosoftInteger && MaxWidth < 128 &&
Context.getTargetInfo().hasInt128Type())
----------------
May as well use `MicrosoftInteger == 128` now.
================
Comment at: lib/Sema/SemaExpr.cpp:3217
@@ +3216,3 @@
+ /*Signed=*/!Literal.isUnsigned);
+ else
+ Ty = Literal.isUnsigned ? Context.UnsignedInt128Ty : Context.Int128Ty;
----------------
Does this do the right thing if long long is 128 bits wide?
================
Comment at: test/SemaCXX/ms_integer_suffix.cpp:8
@@ +7,2 @@
+static_assert(sizeof(0i64 ) == sizeof(__INT64_TYPE__), "");
+static_assert(sizeof(0i128) > sizeof(__INT64_TYPE__), "");
----------------
I think this will fail if the host does not support __int128 (32 bit targets don't).
http://reviews.llvm.org/D4132
More information about the cfe-commits
mailing list