From 2dc8d5fa3ea16c00ce01dd3eed74861489dd998f Mon Sep 17 00:00:00 2001 From: Ken Dyck Date: Mon, 16 Nov 2009 16:36:33 +0000 Subject: Parameterize the constant-generating macros in stdint.h with new built-in __INTn_C_SUFFIX__ macros that are defined for types with corresponding constant suffixes (i.e. long and long long). llvm-svn: 88914 --- clang/lib/Frontend/InitPreprocessor.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'clang/lib/Frontend/InitPreprocessor.cpp') diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 69680491319..9648620ea07 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -240,8 +240,16 @@ static void DefineType(const char *MacroName, TargetInfo::IntType Ty, static void DefineExactWidthIntType(TargetInfo::IntType Ty, const TargetInfo &TI, std::vector &Buf) { char MacroBuf[60]; - sprintf(MacroBuf, "__INT%d_TYPE__", TI.getTypeWidth(Ty)); + int TypeWidth = TI.getTypeWidth(Ty); + sprintf(MacroBuf, "__INT%d_TYPE__", TypeWidth); DefineType(MacroBuf, Ty, Buf); + + + const char *ConstSuffix = TargetInfo::getTypeConstantSuffix(Ty); + if (strlen(ConstSuffix) > 0) { + sprintf(MacroBuf, "__INT%d_C_SUFFIX__=%s", TypeWidth, ConstSuffix); + DefineBuiltinMacro(Buf, MacroBuf); + } } static void InitializePredefinedMacros(const TargetInfo &TI, -- cgit v1.2.3