diff options
author | Joerg Sonnenberger <joerg@bec.de> | 2014-07-17 20:12:32 +0000 |
---|---|---|
committer | Joerg Sonnenberger <joerg@bec.de> | 2014-07-17 20:12:32 +0000 |
commit | 587deea8755b5adab19350b30c71ec5d2c765bf2 (patch) | |
tree | 8cb9cbed040c6461f870c4b508b670c5ce15b63a /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 11698180c336ea4a077a896b79ab2621fb36585f (diff) | |
download | llvm-587deea8755b5adab19350b30c71ec5d2c765bf2.zip llvm-587deea8755b5adab19350b30c71ec5d2c765bf2.tar.gz llvm-587deea8755b5adab19350b30c71ec5d2c765bf2.tar.bz2 |
If char/short are shorter than int, do not use U as suffix for
constants. Comparing int against a constant of the given type like
UINT8_MAX will otherwise force a promotion to unsigned int, which is
typically not expected.
llvm-svn: 213301
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index c0b41c3..7a9d09a 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -238,7 +238,7 @@ static void DefineExactWidthIntType(TargetInfo::IntType Ty, DefineType(Prefix + Twine(TypeWidth) + "_TYPE__", Ty, Builder); DefineFmt(Prefix + Twine(TypeWidth), Ty, TI, Builder); - StringRef ConstSuffix(TargetInfo::getTypeConstantSuffix(Ty)); + StringRef ConstSuffix(TI.getTypeConstantSuffix(Ty)); Builder.defineMacro(Prefix + Twine(TypeWidth) + "_C_SUFFIX__", ConstSuffix); } @@ -655,11 +655,11 @@ static void InitializePredefinedMacros(const TargetInfo &TI, DefineType("__INTMAX_TYPE__", TI.getIntMaxType(), Builder); DefineFmt("__INTMAX", TI.getIntMaxType(), TI, Builder); Builder.defineMacro("__INTMAX_C_SUFFIX__", - TargetInfo::getTypeConstantSuffix(TI.getIntMaxType())); + TI.getTypeConstantSuffix(TI.getIntMaxType())); DefineType("__UINTMAX_TYPE__", TI.getUIntMaxType(), Builder); DefineFmt("__UINTMAX", TI.getUIntMaxType(), TI, Builder); Builder.defineMacro("__UINTMAX_C_SUFFIX__", - TargetInfo::getTypeConstantSuffix(TI.getUIntMaxType())); + TI.getTypeConstantSuffix(TI.getUIntMaxType())); DefineTypeWidth("__INTMAX_WIDTH__", TI.getIntMaxType(), TI, Builder); DefineType("__PTRDIFF_TYPE__", TI.getPtrDiffType(0), Builder); DefineFmt("__PTRDIFF", TI.getPtrDiffType(0), TI, Builder); |