diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-02-05 20:07:43 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-05-14 11:44:47 +0000 | 
| commit | 1fd87a682ad7442327078e1eeb63edc4258f9815 (patch) | |
| tree | 83b42223e987ef7df2e1036937bc1bb627fa2779 /contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp | |
| parent | 04eeddc0aa8e0a417a16eaf9d7d095207f4a8623 (diff) | |
| parent | ecbca9f5fb7d7613d2b94982c4825eb0d33d6842 (diff) | |
Diffstat (limited to 'contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp')
| -rw-r--r-- | contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp b/contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp index a9023a7a1171..e259ab47c558 100644 --- a/contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp +++ b/contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp @@ -25,6 +25,7 @@  #include "clang/Serialization/ASTReader.h"  #include "llvm/ADT/APFloat.h"  #include "llvm/IR/DataLayout.h" +#include "llvm/IR/DerivedTypes.h"  using namespace clang;  static bool MacroBodyEndsInBackslash(StringRef MacroBody) { @@ -914,6 +915,13 @@ static void InitializePredefinedMacros(const TargetInfo &TI,    Builder.defineMacro("__LONG_WIDTH__", Twine(TI.getLongWidth()));    Builder.defineMacro("__LLONG_WIDTH__", Twine(TI.getLongLongWidth())); +  size_t BitIntMaxWidth = TI.getMaxBitIntWidth(); +  assert(BitIntMaxWidth <= llvm::IntegerType::MAX_INT_BITS && +         "Target defined a max bit width larger than LLVM can support!"); +  assert(BitIntMaxWidth >= TI.getLongLongWidth() && +         "Target defined a max bit width smaller than the C standard allows!"); +  Builder.defineMacro("__BITINT_MAXWIDTH__", Twine(BitIntMaxWidth)); +    DefineTypeSize("__SCHAR_MAX__", TargetInfo::SignedChar, TI, Builder);    DefineTypeSize("__SHRT_MAX__", TargetInfo::SignedShort, TI, Builder);    DefineTypeSize("__INT_MAX__", TargetInfo::SignedInt, TI, Builder); | 
