[PATCH] D50477: WIP: Ensure that the type of size_t is represended as one of the fixed width types
Sam Clegg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 8 14:11:16 PDT 2018
sbc100 updated this revision to Diff 159794.
sbc100 added a comment.
remove debugging
Repository:
rC Clang
https://reviews.llvm.org/D50477
Files:
lib/Frontend/InitPreprocessor.cpp
Index: lib/Frontend/InitPreprocessor.cpp
===================================================================
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -870,16 +870,18 @@
if (!TargetInfo::isTypeSigned(TI.getWIntType()))
Builder.defineMacro("__WINT_UNSIGNED__");
+ unsigned SizeTypeWidth = TI.getTypeWidth(TI.getSizeType());
+
// Define exact-width integer types for stdint.h
DefineExactWidthIntType(TargetInfo::SignedChar, TI, Builder);
if (TI.getShortWidth() > TI.getCharWidth())
DefineExactWidthIntType(TargetInfo::SignedShort, TI, Builder);
- if (TI.getIntWidth() > TI.getShortWidth())
+ if (TI.getIntWidth() > TI.getShortWidth() && !(TI.getIntWidth() == SizeTypeWidth && TI.getSignedSizeType() != TargetInfo::SignedInt))
DefineExactWidthIntType(TargetInfo::SignedInt, TI, Builder);
- if (TI.getLongWidth() > TI.getIntWidth())
+ if (TI.getLongWidth() > TI.getIntWidth() || TI.getSignedSizeType() == TargetInfo::SignedLong)
DefineExactWidthIntType(TargetInfo::SignedLong, TI, Builder);
if (TI.getLongLongWidth() > TI.getLongWidth())
@@ -895,13 +897,13 @@
DefineExactWidthIntTypeSize(TargetInfo::SignedShort, TI, Builder);
}
- if (TI.getIntWidth() > TI.getShortWidth()) {
+ if (TI.getIntWidth() > TI.getShortWidth() && !(TI.getIntWidth() == SizeTypeWidth && TI.getSizeType() != TargetInfo::UnsignedInt)) {
DefineExactWidthIntType(TargetInfo::UnsignedInt, TI, Builder);
DefineExactWidthIntTypeSize(TargetInfo::UnsignedInt, TI, Builder);
DefineExactWidthIntTypeSize(TargetInfo::SignedInt, TI, Builder);
}
- if (TI.getLongWidth() > TI.getIntWidth()) {
+ if (TI.getLongWidth() > TI.getIntWidth() || TI.getSizeType() == TargetInfo::UnsignedLong) {
DefineExactWidthIntType(TargetInfo::UnsignedLong, TI, Builder);
DefineExactWidthIntTypeSize(TargetInfo::UnsignedLong, TI, Builder);
DefineExactWidthIntTypeSize(TargetInfo::SignedLong, TI, Builder);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50477.159794.patch
Type: text/x-patch
Size: 1977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180808/70246e19/attachment-0001.bin>
More information about the cfe-commits
mailing list