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 | c0c98291e004d0c9f494b7e50616eaef785b0fef (patch) | |
tree | 69a0b999bd141d9e01f1cb405535466da9bf3343 /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | acfb1dfa4dd3eabeee6d40a08dc0003d415d6ccf (diff) | |
download | bcm5719-llvm-c0c98291e004d0c9f494b7e50616eaef785b0fef.tar.gz bcm5719-llvm-c0c98291e004d0c9f494b7e50616eaef785b0fef.zip |
Predefine __INTMAX_WIDTH__ for the future parameterization of INTMAX macros in
stdint.h.
llvm-svn: 89203
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 4ee286dd265..7fd1d85a8bf 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/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); |