[clang] Make C99 functions builtins only available in C99 mode (PR #190244)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 2 12:55:55 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Danil Sidoruk (eoan-ermine)
<details>
<summary>Changes</summary>
Closes #<!-- -->15522
---
Patch is 29.77 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/190244.diff
5 Files Affected:
- (modified) clang/include/clang/Basic/Builtins.h (+1)
- (modified) clang/include/clang/Basic/Builtins.td (+184-79)
- (modified) clang/include/clang/Basic/BuiltinsBase.td (+6-2)
- (modified) clang/lib/Basic/Builtins.cpp (+3)
- (added) clang/test/C/C89/c99_functions.c (+13)
``````````diff
diff --git a/clang/include/clang/Basic/Builtins.h b/clang/include/clang/Basic/Builtins.h
index 51f0745d47015..ef5cb75edbf7b 100644
--- a/clang/include/clang/Basic/Builtins.h
+++ b/clang/include/clang/Basic/Builtins.h
@@ -46,6 +46,7 @@ enum LanguageID : uint16_t {
ALL_OCL_LANGUAGES = 0x800, // builtin for OCL languages.
HLSL_LANG = 0x1000, // builtin requires HLSL.
C23_LANG = 0x2000, // builtin requires C23 or later.
+ C99_LANG = 0x4000, // builtin requires C99 or later.
ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode.
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index f1743c7286def..5419f75fd4b60 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -11,6 +11,10 @@ include "clang/Basic/BuiltinsBase.td"
class FPMathTemplate : Template<["float", "double", "long double"],
["f", "", "l"]>;
+class FPMathTemplateWithoutDouble :
+ Template<["float", "long double"],
+ ["f", "l"]>;
+
class FPMathWithF16Template :
Template<["float", "double", "long double", "__fp16"],
["f", "", "l", "f16"]>;
@@ -29,6 +33,10 @@ class F16F128MathTemplate : Template<["__fp16", "__float128"],
class IntMathTemplate : Template<["int", "long int", "long long int"],
["", "l", "ll"], /*AsPrefix=*/1>;
+class IntMathTemplateWithoutLongLong :
+ Template<["int", "long int"],
+ ["", "l"], /*AsPrefix=*/1>;
+
class MSInt8_16_32Template : Template<["char", "short", "msint32_t"],
["8", "16", ""]>;
@@ -2943,7 +2951,7 @@ def Abort : LibBuiltin<"stdlib.h"> {
let AddBuiltinPrefixedAlias = 1;
}
-def Abs : IntMathTemplate, LibBuiltin<"stdlib.h"> {
+class AbsBase : LibBuiltinBase<"stdlib.h"> {
let Spellings = ["abs"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T)";
@@ -2951,6 +2959,11 @@ def Abs : IntMathTemplate, LibBuiltin<"stdlib.h"> {
let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
}
+def Abs : IntMathTemplateWithoutLongLong, LibBuiltin<"stdlib.h">, AbsBase;
+
+def AbsC99 : C99LibBuiltin<"stdlib.h">, AbsBase,
+ Template<["long long int"], ["ll"], /*AsPrefix=*/1>;
+
def Calloc : LibBuiltin<"stdlib.h"> {
let Spellings = ["calloc"];
let Prototype = "void*(size_t, size_t)";
@@ -3755,14 +3768,18 @@ def NSLogv : ObjCLibBuiltin<"foundation_nsobjcruntime.h"> {
let Prototype = "void(id, __builtin_va_list)";
}
-def Atan2 : FPMathTemplate, LibBuiltin<"math.h"> {
+class Atan2Base : LibBuiltinBase<"math.h"> {
let Spellings = ["atan2"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Copysign : FPMathTemplate, LibBuiltin<"math.h"> {
+def Atan2 : LibBuiltin<"math.h">, Atan2Base, Template<["double"], [""]>;
+
+def Atan2C99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, Atan2Base;
+
+def Copysign : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["copysign"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T, T)";
@@ -3770,7 +3787,7 @@ def Copysign : FPMathTemplate, LibBuiltin<"math.h"> {
let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
}
-def Fabs : FPMathTemplate, LibBuiltin<"math.h"> {
+class FabsBase : LibBuiltinBase<"math.h"> {
let Spellings = ["fabs"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T)";
@@ -3778,6 +3795,10 @@ def Fabs : FPMathTemplate, LibBuiltin<"math.h"> {
let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
}
+def Fabs : LibBuiltin<"math.h">, FabsBase, Template<["double"], [""]>;
+
+def FabsC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, FabsBase;
+
def Finite : FPMathTemplate, GNULibBuiltin<"math.h"> {
let Spellings = ["finite"];
let Attributes = [NoThrow, Const];
@@ -3791,20 +3812,28 @@ def OSXFinite : FPMathTemplate, LibBuiltin<"math.h"> {
let Prototype = "int(T)";
}
-def Fmod : FPMathTemplate, LibBuiltin<"math.h"> {
+class FmodBase : LibBuiltinBase<"math.h"> {
let Spellings = ["fmod"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Frexp : FPMathTemplate, LibBuiltin<"math.h"> {
+def Fmod : LibBuiltin<"math.h">, FmodBase, Template<["double"], [""]>;
+
+def FmodC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, FmodBase;
+
+class FrexpBase : LibBuiltinBase<"math.h"> {
let Spellings = ["frexp"];
let Attributes = [NoThrow];
let Prototype = "T(T, int*)";
let AddBuiltinPrefixedAlias = 1;
}
+def Frexp : LibBuiltin<"math.h">, FrexpBase, Template<["double"], [""]>;
+
+def FrexpC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, FrexpBase;
+
def Sincos : FPMathTemplate, GNULibBuiltin<"math.h"> {
let Spellings = ["sincos"];
let Attributes = [NoThrow];
@@ -3818,21 +3847,29 @@ def SincosF16F128 : F16F128MathTemplate, Builtin {
let Prototype = "void(T, T*, T*)";
}
-def Ldexp : FPMathTemplate, LibBuiltin<"math.h"> {
+class LdexpBase : LibBuiltinBase<"math.h"> {
let Spellings = ["ldexp"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, int)";
let AddBuiltinPrefixedAlias = 1;
}
-def Modf : FPMathTemplate, LibBuiltin<"math.h"> {
+def Ldexp : LibBuiltin<"math.h">, LdexpBase, Template<["double"], [""]>;
+
+def LdexpC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, LdexpBase;
+
+class ModfBase : LibBuiltinBase<"math.h"> {
let Spellings = ["modf"];
let Attributes = [NoThrow];
let Prototype = "T(T, T*)";
let AddBuiltinPrefixedAlias = 1;
}
-def Nan : FPMathTemplate, LibBuiltin<"math.h"> {
+def Modf : LibBuiltin<"math.h">, ModfBase, Template<["double"], [""]>;
+
+def ModfC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, ModfBase;
+
+def Nan : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["nan"];
let Attributes = [Pure, NoThrow];
let Prototype = "T(char const*)";
@@ -3840,111 +3877,147 @@ def Nan : FPMathTemplate, LibBuiltin<"math.h"> {
let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
}
-def Pow : FPMathTemplate, LibBuiltin<"math.h"> {
+class PowBase : LibBuiltinBase<"math.h"> {
let Spellings = ["pow"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Acos : FPMathTemplate, LibBuiltin<"math.h"> {
+def Pow : LibBuiltin<"math.h">, PowBase, Template<["double"], [""]>;
+
+def PowC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, PowBase;
+
+class AcosBase : LibBuiltinBase<"math.h"> {
let Spellings = ["acos"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Acosh : FPMathTemplate, LibBuiltin<"math.h"> {
+def Acos : LibBuiltin<"math.h">, AcosBase, Template<["double"], [""]>;
+
+def AcosC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, AcosBase;
+
+def Acosh : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["acosh"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Asin : FPMathTemplate, LibBuiltin<"math.h"> {
+class AsinBase : LibBuiltinBase<"math.h"> {
let Spellings = ["asin"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Asinh : FPMathTemplate, LibBuiltin<"math.h"> {
+def Asin : LibBuiltin<"math.h">, AsinBase, Template<["double"], [""]>;
+
+def AsinC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, AsinBase;
+
+def Asinh : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["asinh"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Atan : FPMathTemplate, LibBuiltin<"math.h"> {
+class AtanBase : LibBuiltinBase<"math.h"> {
let Spellings = ["atan"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Atanh : FPMathTemplate, LibBuiltin<"math.h"> {
+def Atan : LibBuiltin<"math.h">, AtanBase, Template<["double"], [""]>;
+
+def AtanC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, AtanBase;
+
+def Atanh : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["atanh"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Cbrt : FPMathTemplate, LibBuiltin<"math.h"> {
+def Cbrt : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["cbrt"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Ceil : FPMathTemplate, LibBuiltin<"math.h"> {
+class CeilBase : LibBuiltinBase<"math.h"> {
let Spellings = ["ceil"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Cos : FPMathTemplate, LibBuiltin<"math.h"> {
+def Ceil : LibBuiltin<"math.h">, CeilBase, Template<["double"], [""]>;
+
+def CeilC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, CeilBase;
+
+class CosBase : LibBuiltinBase<"math.h"> {
let Spellings = ["cos"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Cosh : FPMathTemplate, LibBuiltin<"math.h"> {
+def Cos : LibBuiltin<"math.h">, CosBase, Template<["double"], [""]>;
+
+def CosC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, CosBase;
+
+class CoshBase : LibBuiltinBase<"math.h"> {
let Spellings = ["cosh"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Erf : FPMathTemplate, LibBuiltin<"math.h"> {
+def Cosh : LibBuiltin<"math.h">, CoshBase, Template<["double"], [""]>;
+
+def CoshC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, CoshBase;
+
+def Erf : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["erf"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Erfc : FPMathTemplate, LibBuiltin<"math.h"> {
+def Erfc : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["erfc"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Exp : FPMathTemplate, LibBuiltin<"math.h"> {
+class ExpBase : LibBuiltinBase<"math.h"> {
let Spellings = ["exp"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Exp2 : FPMathTemplate, LibBuiltin<"math.h"> {
+def Exp : LibBuiltin<"math.h">, ExpBase, Template<["double"], [""]>;
+
+def ExpC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, ExpBase;
+
+class Exp2Base : LibBuiltinBase<"math.h"> {
let Spellings = ["exp2"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
+def Exp2 : LibBuiltin<"math.h">, Exp2Base, Template<["double"], [""]>;
+
+def Exp2C99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, Exp2Base;
+
// FIXME: Why is there no builtin without the prefix?
def Exp10 : FPMathTemplate, Builtin {
let Spellings = ["__builtin_exp10"];
@@ -3953,35 +4026,39 @@ def Exp10 : FPMathTemplate, Builtin {
let Prototype = "T(T)";
}
-def Expm1 : FPMathTemplate, LibBuiltin<"math.h"> {
+def Expm1 : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["expm1"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Fdim : FPMathTemplate, LibBuiltin<"math.h"> {
+def Fdim : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["fdim"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Floor : FPMathTemplate, LibBuiltin<"math.h"> {
+class FloorBase : LibBuiltinBase<"math.h"> {
let Spellings = ["floor"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Fma : FPMathTemplate, LibBuiltin<"math.h"> {
+def Floor : LibBuiltin<"math.h">, FloorBase, Template<["double"], [""]>;
+
+def FloorC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, FloorBase;
+
+def Fma : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["fma"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, T, T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Fmax : FPMathTemplate, LibBuiltin<"math.h"> {
+def Fmax : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["fmax"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T, T)";
@@ -3989,7 +4066,7 @@ def Fmax : FPMathTemplate, LibBuiltin<"math.h"> {
let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
}
-def Fmin : FPMathTemplate, LibBuiltin<"math.h"> {
+def Fmin : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["fmin"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T, T)";
@@ -4013,133 +4090,141 @@ def FminimumNum : FPMathTemplate, LibBuiltin<"math.h"> {
let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
}
-def Hypot : FPMathTemplate, LibBuiltin<"math.h"> {
+def Hypot : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["hypot"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Ilogb : FPMathTemplate, LibBuiltin<"math.h"> {
+def Ilogb : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["ilogb"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "int(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Lgamma : FPMathTemplate, LibBuiltin<"math.h"> {
+def Lgamma : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["lgamma"];
let Attributes = [NoThrow];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Llrint : FPMathTemplate, LibBuiltin<"math.h"> {
+def Llrint : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["llrint"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "long long int(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Llround : FPMathTemplate, LibBuiltin<"math.h"> {
+def Llround : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["llround"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "long long int(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Log : FPMathTemplate, LibBuiltin<"math.h"> {
+class LogBase : LibBuiltinBase<"math.h"> {
let Spellings = ["log"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Log10 : FPMathTemplate, LibBuiltin<"math.h"> {
+def Log : LibBuiltin<"math.h">, LogBase, Template<["double"], [""]>;
+
+def LogC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, LogBase;
+
+class Log10Base : LibBuiltinBase<"math.h"> {
let Spellings = ["log10"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Log1p : FPMathTemplate, LibBuiltin<"math.h"> {
+def Log10 : LibBuiltin<"math.h">, Log10Base, Template<["double"], [""]>;
+
+def Log10C99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, Log10Base;
+
+def Log1p : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["log1p"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Log2 : FPMathTemplate, LibBuiltin<"math.h"> {
+def Log2 : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["log2"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Logb : FPMathTemplate, LibBuiltin<"math.h"> {
+def Logb : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["logb"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Lrint : FPMathTemplate, LibBuiltin<"math.h"> {
+def Lrint : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["lrint"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "long int(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Lround : FPMathTemplate, LibBuiltin<"math.h"> {
+def Lround : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["lround"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "long int(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Nearbyint : FPMathTemplate, LibBuiltin<"math.h"> {
+def Nearbyint : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["nearbyint"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Nextafter : FPMathTemplate, LibBuiltin<"math.h"> {
+def Nextafter : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["nextafter"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Nexttoward : FPMathTemplate, LibBuiltin<"math.h"> {
+def Nexttoward : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["nexttoward"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, long double)";
let AddBuiltinPrefixedAlias = 1;
}
-def Remainder : FPMathTemplate, LibBuiltin<"math.h"> {
+def Remainder : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["remainder"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Remquo : FPMathTemplate, LibBuiltin<"math.h"> {
+def Remquo : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["remquo"];
let Attributes = [NoThrow];
let Prototype = "T(T, T, int*)";
let AddBuiltinPrefixedAlias = 1;
}
-def Rint : FPMathTemplate, LibBuiltin<"math.h"> {
+def Rint : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["rint"];
let Attributes = [NoThrow, ConstIgnoringExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Round : FPMathTemplate, LibBuiltin<"math.h"> {
+def Round : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["round"];
let Attributes = [NoThrow, Const];
let Prototype = "T(T)";
@@ -4153,210 +4238,230 @@ def RoundEven : FPMathTemplate, LibBuiltin<"math.h"> {
let AddBuiltinPrefixedAlias = 1;
}
-def Scalbln : FPMathTemplate, LibBuiltin<"math.h"> {
+def Scalbln : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["scalbln"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, long int)";
let AddBuiltinPrefixedAlias = 1;
}
-def Scalbn : FPMathTemplate, LibBuiltin<"math.h"> {
+def Scalbn : FPMathTemplate, C99LibBuiltin<"math.h"> {
let Spellings = ["scalbn"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T, int)";
let AddBuiltinPrefixedAlias = 1;
}
-def Sin : FPMathTemplate, LibBuiltin<"math.h"> {
+class SinBase : LibBuiltinBase<"math.h"> {
let Spellings = ["sin"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Sinh : FPMathTemplate, LibBuiltin<"math.h"> {
+def Sin : LibBuiltin<"math.h">, SinBase, Template<["double"], [""]>;
+
+def SinC99 : FPMathTemplateWithoutDouble, C99LibBuiltin<"math.h">, SinBase;
+
+class SinhBase : LibBuiltinBase<"math.h"> {
let Spellings = ["sinh"];
let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
let Prototype = "T(T)";
let AddBuiltinPrefixedAlias = 1;
}
-def Sqrt : FPMathTemplat...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/190244
More information about the cfe-commits
mailing list