Skip to content

Commit 5122fd9

Browse files
[Clang] Fixes of builtins definitions after PR #68324.
This commit addresses few differences between the `Builtins.def` file before the refactoring done in PR #68324 and the currently generated `Builtins.inc` file.
1 parent e28ca2d commit 5122fd9

File tree

1 file changed

+43
-27
lines changed

1 file changed

+43
-27
lines changed

clang/include/clang/Basic/Builtins.td

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ class FPMathTemplate : Template<["float", "double", "long double"],
1212
["f", "", "l"]>;
1313

1414
class FPMathWithF16Template :
15-
Template<["float", "double", "long double", "__fp16", "__float128"],
16-
["f", "", "l", "f16", "f128"]>;
15+
Template<["float", "double", "long double", "__fp16"],
16+
["f", "", "l", "f16"]>;
1717

1818
class FPMathWithF16F128Template :
1919
Template<["float", "double", "long double", "__fp16", "__float128"],
2020
["f", "", "l", "f16", "f128"]>;
2121

22+
class FPMathWithF128Template :
23+
Template<["float", "double", "long double", "__float128"],
24+
["f", "", "l", "f128"]>;
25+
2226
class F16F128MathTemplate : Template<["__fp16", "__float128"],
2327
["f16", "f128"]>;
2428

@@ -253,18 +257,30 @@ def FrexpF16F128 : F16F128MathTemplate, Builtin {
253257
let Prototype = "T(T, int*)";
254258
}
255259

256-
def HugeVal : Builtin, FPMathWithF16F128Template {
260+
def HugeVal : Builtin, FPMathWithF128Template {
257261
let Spellings = ["__builtin_huge_val"];
258262
let Attributes = [NoThrow, Const, Constexpr];
259263
let Prototype = "T()";
260264
}
261265

262-
def Inf : Builtin, FPMathWithF16F128Template {
266+
def HugeValF16 : Builtin {
267+
let Spellings = ["__builtin_huge_valf16"];
268+
let Attributes = [NoThrow, Const, Constexpr];
269+
let Prototype = "_Float16()";
270+
}
271+
272+
def Inf : Builtin, FPMathWithF128Template {
263273
let Spellings = ["__builtin_inf"];
264274
let Attributes = [NoThrow, Const, Constexpr];
265275
let Prototype = "T()";
266276
}
267277

278+
def InfF16 : Builtin {
279+
let Spellings = ["__builtin_inff16"];
280+
let Attributes = [NoThrow, Const, Constexpr];
281+
let Prototype = "_Float16()";
282+
}
283+
268284
def LdexpF16F128 : F16F128MathTemplate, Builtin {
269285
let Spellings = ["__builtin_ldexp"];
270286
let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
@@ -1538,7 +1554,7 @@ def SyncBoolCompareAndSwap : Builtin {
15381554
def SyncBoolCompareAndSwapN : Builtin, SyncBuiltinsTemplate {
15391555
let Spellings = ["__sync_bool_compare_and_swap_"];
15401556
let Attributes = [CustomTypeChecking, NoThrow];
1541-
let Prototype = "T(T volatile*, T, ...)";
1557+
let Prototype = "bool(T volatile*, T, T, ...)";
15421558
}
15431559

15441560
def SyncValCompareAndSwap : Builtin {
@@ -1550,7 +1566,7 @@ def SyncValCompareAndSwap : Builtin {
15501566
def SynLockValCompareAndSwapN : Builtin, SyncBuiltinsTemplate {
15511567
let Spellings = ["__sync_val_compare_and_swap_"];
15521568
let Attributes = [CustomTypeChecking, NoThrow];
1553-
let Prototype = "T(T volatile*, T, ...)";
1569+
let Prototype = "T(T volatile*, T, T, ...)";
15541570
}
15551571

15561572
def SyncLockTestAndSet : Builtin {
@@ -1565,16 +1581,16 @@ def SynLockLockTestAndSetN : Builtin, SyncBuiltinsTemplate {
15651581
let Prototype = "T(T volatile*, T, ...)";
15661582
}
15671583

1568-
def SyncLockReleaseN : Builtin {
1584+
def SyncLockRelease : Builtin {
15691585
let Spellings = ["__sync_lock_release"];
15701586
let Attributes = [CustomTypeChecking];
15711587
let Prototype = "void(...)";
15721588
}
15731589

1574-
def SynLockReleaseN : Builtin, SyncBuiltinsTemplate {
1590+
def SyncLockReleaseN : Builtin, SyncBuiltinsTemplate {
15751591
let Spellings = ["__sync_lock_release_"];
15761592
let Attributes = [CustomTypeChecking, NoThrow];
1577-
let Prototype = "T(T volatile*, T, ...)";
1593+
let Prototype = "void(T volatile*, ...)";
15781594
}
15791595

15801596
def SyncSwap : Builtin {
@@ -2557,6 +2573,13 @@ def Abort : LibBuiltin<"stdlib.h"> {
25572573
let AddBuiltinPrefixedAlias = 1;
25582574
}
25592575

2576+
def Abs : IntMathTemplate, LibBuiltin<"stdlib.h"> {
2577+
let Spellings = ["abs"];
2578+
let Attributes = [NoThrow, Const];
2579+
let Prototype = "T(T)";
2580+
let AddBuiltinPrefixedAlias = 1;
2581+
}
2582+
25602583
def Calloc : LibBuiltin<"stdlib.h"> {
25612584
let Spellings = ["calloc"];
25622585
let Prototype = "void*(size_t, size_t)";
@@ -3073,38 +3096,38 @@ def MemAlign : GNULibBuiltin<"malloc.h"> {
30733096

30743097
// POSIX string.h
30753098

3076-
def MemcCpy : GNULibBuiltin<"stdlib.h"> {
3099+
def MemcCpy : GNULibBuiltin<"string.h"> {
30773100
let Spellings = ["memccpy"];
30783101
let Prototype = "void*(void*, void const*, int, size_t)";
30793102
}
30803103

3081-
def MempCpy : GNULibBuiltin<"stdlib.h"> {
3104+
def MempCpy : GNULibBuiltin<"string.h"> {
30823105
let Spellings = ["mempcpy"];
30833106
let Prototype = "void*(void*, void const*, size_t)";
30843107
}
30853108

3086-
def StpCpy : GNULibBuiltin<"stdlib.h"> {
3109+
def StpCpy : GNULibBuiltin<"string.h"> {
30873110
let Spellings = ["stpcpy"];
30883111
let Attributes = [NoThrow];
30893112
let Prototype = "char*(char*, char const*)";
30903113
let AddBuiltinPrefixedAlias = 1;
30913114
}
30923115

3093-
def StpnCpy : GNULibBuiltin<"stdlib.h"> {
3116+
def StpnCpy : GNULibBuiltin<"string.h"> {
30943117
let Spellings = ["stpncpy"];
30953118
let Attributes = [NoThrow];
30963119
let Prototype = "char*(char*, char const*, size_t)";
30973120
let AddBuiltinPrefixedAlias = 1;
30983121
}
30993122

3100-
def StrDup : GNULibBuiltin<"stdlib.h"> {
3123+
def StrDup : GNULibBuiltin<"string.h"> {
31013124
let Spellings = ["strdup"];
31023125
let Attributes = [NoThrow];
31033126
let Prototype = "char*(char const*)";
31043127
let AddBuiltinPrefixedAlias = 1;
31053128
}
31063129

3107-
def StrnDup : GNULibBuiltin<"stdlib.h"> {
3130+
def StrnDup : GNULibBuiltin<"string.h"> {
31083131
let Spellings = ["strndup"];
31093132
let Attributes = [NoThrow];
31103133
let Prototype = "char*(char const*, size_t)";
@@ -3274,22 +3297,22 @@ def ObjcEnumerationMutation : ObjCLibBuiltin<"objc/runtime.h"> {
32743297
let Prototype = "void(id)";
32753298
}
32763299

3277-
def ObjcReadWeak : ObjCLibBuiltin<"objc/message.h"> {
3300+
def ObjcReadWeak : ObjCLibBuiltin<"objc/objc-auto.h"> {
32783301
let Spellings = ["objc_read_weak"];
32793302
let Prototype = "id(id*)";
32803303
}
32813304

3282-
def ObjcAssignWeak : ObjCLibBuiltin<"objc/message.h"> {
3305+
def ObjcAssignWeak : ObjCLibBuiltin<"objc/objc-auto.h"> {
32833306
let Spellings = ["objc_assign_weak"];
32843307
let Prototype = "id(id, id*)";
32853308
}
32863309

3287-
def ObjcAssignIvar : ObjCLibBuiltin<"objc/message.h"> {
3310+
def ObjcAssignIvar : ObjCLibBuiltin<"objc/objc-auto.h"> {
32883311
let Spellings = ["objc_assign_ivar"];
32893312
let Prototype = "id(id, id, ptrdiff_t)";
32903313
}
32913314

3292-
def ObjcAssignGlobal : ObjCLibBuiltin<"objc/message.h"> {
3315+
def ObjcAssignGlobal : ObjCLibBuiltin<"objc/objc-auto.h"> {
32933316
let Spellings = ["objc_assign_global"];
32943317
let Prototype = "id(id, id*)";
32953318
}
@@ -3359,13 +3382,6 @@ def Atan2 : FPMathTemplate, LibBuiltin<"math.h"> {
33593382
let AddBuiltinPrefixedAlias = 1;
33603383
}
33613384

3362-
def Abs : IntMathTemplate, LibBuiltin<"math.h"> {
3363-
let Spellings = ["abs"];
3364-
let Attributes = [NoThrow, Const];
3365-
let Prototype = "T(T)";
3366-
let AddBuiltinPrefixedAlias = 1;
3367-
}
3368-
33693385
def Copysign : FPMathTemplate, LibBuiltin<"math.h"> {
33703386
let Spellings = ["copysign"];
33713387
let Attributes = [NoThrow, Const];
@@ -4024,7 +4040,7 @@ def Move : CxxLibBuiltin<"utility"> {
40244040
let Namespace = "std";
40254041
}
40264042

4027-
def MoveIfNsoexcept : CxxLibBuiltin<"memory"> {
4043+
def MoveIfNsoexcept : CxxLibBuiltin<"utility"> {
40284044
let Spellings = ["move_if_noexcept"];
40294045
let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration,
40304046
Constexpr];

0 commit comments

Comments
 (0)