summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-29 04:54:24 +0000
committerChris Lattner <sabre@nondot.org>2009-10-29 04:54:24 +0000
commitd0952749f74b71e49412ae047dcf794ea3be4bcf (patch)
tree1b6f269cd17eecd6d38ce8a1f7aed314c6d98576 /clang/lib/Frontend/InitPreprocessor.cpp
parent0590837d3463d3d2a0f6c9a1efbcf2ab3e019e5f (diff)
downloadbcm5719-llvm-d0952749f74b71e49412ae047dcf794ea3be4bcf.tar.gz
bcm5719-llvm-d0952749f74b71e49412ae047dcf794ea3be4bcf.zip
simplify intmax setup, patch by Ken Dyck!
llvm-svn: 85481
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index b1a0a5ee8d5..ecae355f654 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -346,27 +346,15 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
assert(TI.getCharWidth() == 8 && "Only support 8-bit char so far");
DefineBuiltinMacro(Buf, "__CHAR_BIT__=8");
- unsigned IntMaxWidth;
- const char *IntMaxSuffix;
- if (TI.getIntMaxType() == TargetInfo::SignedLongLong) {
- IntMaxWidth = TI.getLongLongWidth();
- IntMaxSuffix = "LL";
- } else if (TI.getIntMaxType() == TargetInfo::SignedLong) {
- IntMaxWidth = TI.getLongWidth();
- IntMaxSuffix = "L";
- } else {
- assert(TI.getIntMaxType() == TargetInfo::SignedInt);
- IntMaxWidth = TI.getIntWidth();
- IntMaxSuffix = "";
- }
-
DefineTypeSize("__SCHAR_MAX__", TI.getCharWidth(), "", true, Buf);
DefineTypeSize("__SHRT_MAX__", TI.getShortWidth(), "", true, Buf);
DefineTypeSize("__INT_MAX__", TI.getIntWidth(), "", true, Buf);
DefineTypeSize("__LONG_MAX__", TI.getLongWidth(), "L", true, Buf);
DefineTypeSize("__LONG_LONG_MAX__", TI.getLongLongWidth(), "LL", true, Buf);
DefineTypeSize("__WCHAR_MAX__", TI.getWCharWidth(), "", true, Buf);
- DefineTypeSize("__INTMAX_MAX__", IntMaxWidth, IntMaxSuffix, true, Buf);
+ TargetInfo::IntType IntMaxType = TI.getIntMaxType();
+ DefineTypeSize("__INTMAX_MAX__", TI.getTypeWidth(IntMaxType),
+ TI.getTypeConstantSuffix(IntMaxType), true, Buf);
DefineType("__INTMAX_TYPE__", TI.getIntMaxType(), Buf);
DefineType("__UINTMAX_TYPE__", TI.getUIntMaxType(), Buf);
OpenPOWER on IntegriCloud