]> granicus.if.org Git - clang/commitdiff
simplify intmax setup, patch by Ken Dyck!
authorChris Lattner <sabre@nondot.org>
Thu, 29 Oct 2009 04:54:24 +0000 (04:54 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 29 Oct 2009 04:54:24 +0000 (04:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85481 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp

index b1a0a5ee8d510179119472c95d1f3c90cebc35e0..ecae355f6544fd8ca71bde572fee168fa76e17f1 100644 (file)
@@ -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);