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);
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);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits