diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -365,9 +365,21 @@ virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const; /// Return the smallest integer type with at least the specified width. + /// + /// This will be used for `{u}int_least_t` in C. virtual IntType getLeastIntTypeByWidth(unsigned BitWidth, bool IsSigned) const; + /// Return the "fastest" integer type with at least the specified width. + /// + /// This will be used for `{u}int_fast_t` in C. + /// + /// The default implementation will match getLeastIntTypeByWidth. + virtual IntType getFastIntTypeByWidth(unsigned BitWidth, + bool IsSigned) const { + return getLeastIntTypeByWidth(BitWidth, IsSigned); + } + /// Return floating point type with specified width. On PPC, there are /// three possible types for 128-bit floating point: "PPC double-double", /// IEEE 754R quad precision, and "long double" (which under the covers diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -257,7 +257,7 @@ const TargetInfo &TI, MacroBuilder &Builder) { // stdint.h currently defines the fast int types as equivalent to the least // types. - TargetInfo::IntType Ty = TI.getLeastIntTypeByWidth(TypeWidth, IsSigned); + TargetInfo::IntType Ty = TI.getFastIntTypeByWidth(TypeWidth, IsSigned); if (Ty == TargetInfo::NoInt) return;