diff options
author | Ken Dyck <ken.dyck@onsemi.com> | 2009-11-18 13:52:57 +0000 |
---|---|---|
committer | Ken Dyck <ken.dyck@onsemi.com> | 2009-11-18 13:52:57 +0000 |
commit | 186696bee3b3544d942bb43041595e210de577c6 (patch) | |
tree | 073881166a4a19f09c0fa49310348fa2d183acfb /lib/Frontend/InitPreprocessor.cpp | |
parent | 25b825d1a48fb4d64cb553bef7a316469e89c46a (diff) |
Predefine __INTMAX_WIDTH__ for the future parameterization of INTMAX macros in
stdint.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89203 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | lib/Frontend/InitPreprocessor.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 4ee286dd26..7fd1d85a8b 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -237,6 +237,13 @@ static void DefineType(const char *MacroName, TargetInfo::IntType Ty, DefineBuiltinMacro(Buf, MacroBuf); } +static void DefineTypeWidth(const char *MacroName, TargetInfo::IntType Ty, + const TargetInfo &TI, std::vector<char> &Buf) { + char MacroBuf[60]; + sprintf(MacroBuf, "%s=%d", MacroName, TI.getTypeWidth(Ty)); + DefineBuiltinMacro(Buf, MacroBuf); +} + static void DefineExactWidthIntType(TargetInfo::IntType Ty, const TargetInfo &TI, std::vector<char> &Buf) { char MacroBuf[60]; @@ -383,6 +390,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, DefineType("__INTMAX_TYPE__", TI.getIntMaxType(), Buf); DefineType("__UINTMAX_TYPE__", TI.getUIntMaxType(), Buf); + DefineTypeWidth("__INTMAX_WIDTH__", TI.getIntMaxType(), TI, Buf); DefineType("__PTRDIFF_TYPE__", TI.getPtrDiffType(0), Buf); DefineType("__INTPTR_TYPE__", TI.getIntPtrType(), Buf); DefineType("__SIZE_TYPE__", TI.getSizeType(), Buf); |