diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-10-21 19:24:06 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-10-21 19:24:06 +0000 |
commit | 7a6f36440d9dcf728671a9ff955910457b90d9b5 (patch) | |
tree | 5dfdb87e194fa74d9ede1bf611b01b394611b586 /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 4add5dc0931ee68e502f8a614c220913031660e2 (diff) | |
download | bcm5719-llvm-7a6f36440d9dcf728671a9ff955910457b90d9b5.tar.gz bcm5719-llvm-7a6f36440d9dcf728671a9ff955910457b90d9b5.zip |
Follow-up commit to r211657 which introduced these macros, but not for MSVC. This turns out to break our freestanding tests on Windows when compiling in MSVC-compatible mode. It was decided (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20141020/116942.html is the start of the thread) to support this as part of Clang's interface on all platforms.
llvm-svn: 220312
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 102 |
1 files changed, 48 insertions, 54 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index daff9ce9114..802b2a95cc8 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -627,12 +627,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI, DefineTypeSize("__INTMAX_MAX__", TI.getIntMaxType(), TI, Builder); DefineTypeSize("__SIZE_MAX__", TI.getSizeType(), TI, Builder); - if (!LangOpts.MSVCCompat) { - DefineTypeSize("__UINTMAX_MAX__", TI.getUIntMaxType(), TI, Builder); - DefineTypeSize("__PTRDIFF_MAX__", TI.getPtrDiffType(0), TI, Builder); - DefineTypeSize("__INTPTR_MAX__", TI.getIntPtrType(), TI, Builder); - DefineTypeSize("__UINTPTR_MAX__", TI.getUIntPtrType(), TI, Builder); - } + DefineTypeSize("__UINTMAX_MAX__", TI.getUIntMaxType(), TI, Builder); + DefineTypeSize("__PTRDIFF_MAX__", TI.getPtrDiffType(0), TI, Builder); + DefineTypeSize("__INTPTR_MAX__", TI.getIntPtrType(), TI, Builder); + DefineTypeSize("__UINTPTR_MAX__", TI.getUIntPtrType(), TI, Builder); DefineTypeSizeof("__SIZEOF_DOUBLE__", TI.getDoubleWidth(), TI, Builder); DefineTypeSizeof("__SIZEOF_FLOAT__", TI.getFloatWidth(), TI, Builder); @@ -680,12 +678,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI, DefineType("__CHAR16_TYPE__", TI.getChar16Type(), Builder); DefineType("__CHAR32_TYPE__", TI.getChar32Type(), Builder); - if (!LangOpts.MSVCCompat) { - DefineTypeWidth("__UINTMAX_WIDTH__", TI.getUIntMaxType(), TI, Builder); - DefineType("__UINTPTR_TYPE__", TI.getUIntPtrType(), Builder); - DefineFmt("__UINTPTR", TI.getUIntPtrType(), TI, Builder); - DefineTypeWidth("__UINTPTR_WIDTH__", TI.getUIntPtrType(), TI, Builder); - } + DefineTypeWidth("__UINTMAX_WIDTH__", TI.getUIntMaxType(), TI, Builder); + DefineType("__UINTPTR_TYPE__", TI.getUIntPtrType(), Builder); + DefineFmt("__UINTPTR", TI.getUIntPtrType(), TI, Builder); + DefineTypeWidth("__UINTPTR_WIDTH__", TI.getUIntPtrType(), TI, Builder); DefineFloatMacros(Builder, "FLT", &TI.getFloatFormat(), "F"); DefineFloatMacros(Builder, "DBL", &TI.getDoubleFormat(), ""); @@ -719,54 +715,52 @@ static void InitializePredefinedMacros(const TargetInfo &TI, if (TI.getLongLongWidth() > TI.getLongWidth()) DefineExactWidthIntType(TargetInfo::SignedLongLong, TI, Builder); - if (!LangOpts.MSVCCompat) { - DefineExactWidthIntType(TargetInfo::UnsignedChar, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::UnsignedChar, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::SignedChar, TI, Builder); - - if (TI.getShortWidth() > TI.getCharWidth()) { - DefineExactWidthIntType(TargetInfo::UnsignedShort, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::UnsignedShort, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::SignedShort, TI, Builder); - } + DefineExactWidthIntType(TargetInfo::UnsignedChar, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::UnsignedChar, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::SignedChar, TI, Builder); - if (TI.getIntWidth() > TI.getShortWidth()) { - DefineExactWidthIntType(TargetInfo::UnsignedInt, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::UnsignedInt, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::SignedInt, TI, Builder); - } + if (TI.getShortWidth() > TI.getCharWidth()) { + DefineExactWidthIntType(TargetInfo::UnsignedShort, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::UnsignedShort, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::SignedShort, TI, Builder); + } - if (TI.getLongWidth() > TI.getIntWidth()) { - DefineExactWidthIntType(TargetInfo::UnsignedLong, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::UnsignedLong, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::SignedLong, TI, Builder); - } + if (TI.getIntWidth() > TI.getShortWidth()) { + DefineExactWidthIntType(TargetInfo::UnsignedInt, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::UnsignedInt, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::SignedInt, TI, Builder); + } - if (TI.getLongLongWidth() > TI.getLongWidth()) { - DefineExactWidthIntType(TargetInfo::UnsignedLongLong, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::UnsignedLongLong, TI, Builder); - DefineExactWidthIntTypeSize(TargetInfo::SignedLongLong, TI, Builder); - } + if (TI.getLongWidth() > TI.getIntWidth()) { + DefineExactWidthIntType(TargetInfo::UnsignedLong, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::UnsignedLong, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::SignedLong, TI, Builder); + } - DefineLeastWidthIntType(8, true, TI, Builder); - DefineLeastWidthIntType(8, false, TI, Builder); - DefineLeastWidthIntType(16, true, TI, Builder); - DefineLeastWidthIntType(16, false, TI, Builder); - DefineLeastWidthIntType(32, true, TI, Builder); - DefineLeastWidthIntType(32, false, TI, Builder); - DefineLeastWidthIntType(64, true, TI, Builder); - DefineLeastWidthIntType(64, false, TI, Builder); - - DefineFastIntType(8, true, TI, Builder); - DefineFastIntType(8, false, TI, Builder); - DefineFastIntType(16, true, TI, Builder); - DefineFastIntType(16, false, TI, Builder); - DefineFastIntType(32, true, TI, Builder); - DefineFastIntType(32, false, TI, Builder); - DefineFastIntType(64, true, TI, Builder); - DefineFastIntType(64, false, TI, Builder); + if (TI.getLongLongWidth() > TI.getLongWidth()) { + DefineExactWidthIntType(TargetInfo::UnsignedLongLong, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::UnsignedLongLong, TI, Builder); + DefineExactWidthIntTypeSize(TargetInfo::SignedLongLong, TI, Builder); } + DefineLeastWidthIntType(8, true, TI, Builder); + DefineLeastWidthIntType(8, false, TI, Builder); + DefineLeastWidthIntType(16, true, TI, Builder); + DefineLeastWidthIntType(16, false, TI, Builder); + DefineLeastWidthIntType(32, true, TI, Builder); + DefineLeastWidthIntType(32, false, TI, Builder); + DefineLeastWidthIntType(64, true, TI, Builder); + DefineLeastWidthIntType(64, false, TI, Builder); + + DefineFastIntType(8, true, TI, Builder); + DefineFastIntType(8, false, TI, Builder); + DefineFastIntType(16, true, TI, Builder); + DefineFastIntType(16, false, TI, Builder); + DefineFastIntType(32, true, TI, Builder); + DefineFastIntType(32, false, TI, Builder); + DefineFastIntType(64, true, TI, Builder); + DefineFastIntType(64, false, TI, Builder); + if (const char *Prefix = TI.getUserLabelPrefix()) Builder.defineMacro("__USER_LABEL_PREFIX__", Prefix); |