Skip to content

Commit f65bd5f

Browse files
committed
[clang] Merge some delarations which currently have different attributes
1 parent e099e7b commit f65bd5f

File tree

1 file changed

+17
-59
lines changed

1 file changed

+17
-59
lines changed

clang/include/clang/Basic/Builtins.td

Lines changed: 17 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -727,12 +727,6 @@ def RotateRight : BitInt8_16_32_64BuiltinsTemplate, Builtin {
727727
// FIXME: The builtins marked FunctionWithBuiltinPrefix below should be
728728
// merged with the library definitions. They are currently not because
729729
// the attributes are different.
730-
def BuiltinCalloc : Builtin {
731-
let Spellings = ["__builtin_calloc"];
732-
let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
733-
let Prototype = "void*(size_t, size_t)";
734-
}
735-
736730
def BuiltinConstantP : Builtin {
737731
let Spellings = ["__builtin_constant_p"];
738732
let Attributes = [NoThrow, Const, CustomTypeChecking, UnevaluatedArguments, Constexpr];
@@ -775,48 +769,18 @@ def BuiltinAssumeAligned : Builtin {
775769
let Prototype = "void*(void const*, size_t, ...)";
776770
}
777771

778-
def BuiltinFree : Builtin {
779-
let Spellings = ["__builtin_free"];
780-
let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
781-
let Prototype = "void(void*)";
782-
}
783-
784-
def BuiltinMalloc : Builtin {
785-
let Spellings = ["__builtin_malloc"];
786-
let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
787-
let Prototype = "void*(size_t)";
788-
}
789-
790772
def BuiltinMemcpyInline : Builtin {
791773
let Spellings = ["__builtin_memcpy_inline"];
792774
let Attributes = [NoThrow];
793775
let Prototype = "void(void*, void const*, _Constant size_t)";
794776
}
795777

796-
def BuiltinMempcpy : Builtin {
797-
let Spellings = ["__builtin_mempcpy"];
798-
let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
799-
let Prototype = "void*(void*, void const*, size_t)";
800-
}
801-
802778
def BuiltinMemsetInline : Builtin {
803779
let Spellings = ["__builtin_memset_inline"];
804780
let Attributes = [NoThrow];
805781
let Prototype = "void(void*, int, _Constant size_t)";
806782
}
807783

808-
def BuiltinStrcspn : Builtin {
809-
let Spellings = ["__builtin_strcspn"];
810-
let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
811-
let Prototype = "size_t(char const*, char const*)";
812-
}
813-
814-
def BuiltinRealloc : Builtin {
815-
let Spellings = ["__builtin_realloc"];
816-
let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
817-
let Prototype = "void*(void*, size_t)";
818-
}
819-
820784
def BuiltinReturnAddress : Builtin {
821785
let Spellings = ["__builtin_return_address"];
822786
let Attributes = [NoThrow];
@@ -2539,7 +2503,9 @@ def Abort : LibBuiltin<"stdlib.h"> {
25392503

25402504
def Calloc : LibBuiltin<"stdlib.h"> {
25412505
let Spellings = ["calloc"];
2506+
let Attributes = [NoThrow];
25422507
let Prototype = "void*(size_t, size_t)";
2508+
let AddBuiltinPrefixedAlias = 1;
25432509
}
25442510

25452511
def Exit : LibBuiltin<"stdlib.h"> {
@@ -2550,17 +2516,23 @@ def Exit : LibBuiltin<"stdlib.h"> {
25502516

25512517
def Malloc : LibBuiltin<"stdlib.h"> {
25522518
let Spellings = ["malloc"];
2519+
let Attributes = [NoThrow];
25532520
let Prototype = "void*(size_t)";
2521+
let AddBuiltinPrefixedAlias = 1;
25542522
}
25552523

25562524
def Realloc : LibBuiltin<"stdlib.h"> {
25572525
let Spellings = ["realloc"];
2526+
let Attributes = [NoThrow];
25582527
let Prototype = "void*(void*, size_t)";
2528+
let AddBuiltinPrefixedAlias = 1;
25592529
}
25602530

25612531
def Free : LibBuiltin<"stdlib.h"> {
25622532
let Spellings = ["free"];
2533+
let Attributes = [NoThrow];
25632534
let Prototype = "void(void*)";
2535+
let AddBuiltinPrefixedAlias = 1;
25642536
}
25652537

25662538
def StrToD : LibBuiltin<"stdlib.h"> {
@@ -2612,16 +2584,11 @@ def MemCpy : LibBuiltin<"string.h"> {
26122584
let AddBuiltinPrefixedAlias = 1;
26132585
}
26142586

2615-
def BuiltinMemCmp : Builtin {
2616-
let Spellings = ["__builtin_memcmp"];
2617-
let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Constexpr];
2618-
let Prototype = "int(void const*, void const*, size_t)";
2619-
}
2620-
26212587
def MemCmp : LibBuiltin<"string.h"> {
26222588
let Spellings = ["memcmp"];
2623-
let Attributes = [Constexpr];
2589+
let Attributes = [NoThrow, Constexpr];
26242590
let Prototype = "int(void const*, void const*, size_t)";
2591+
let AddBuiltinPrefixedAlias = 1;
26252592
}
26262593

26272594
def MemMove : LibBuiltin<"string.h"> {
@@ -2694,7 +2661,9 @@ def StrChr : LibBuiltin<"string.h"> {
26942661

26952662
def StrcSpn : LibBuiltin<"string.h"> {
26962663
let Spellings = ["strcspn"];
2664+
let Attributes = [NoThrow];
26972665
let Prototype = "size_t(char const*, char const*)";
2666+
let AddBuiltinPrefixedAlias = 1;
26982667
}
26992668

27002669
def StrpBrk : LibBuiltin<"string.h"> {
@@ -2753,14 +2722,7 @@ def StrLen : LibBuiltin<"string.h"> {
27532722
// FIXME: This list is incomplete.
27542723
def Printf : LibBuiltin<"stdio.h"> {
27552724
let Spellings = ["printf"];
2756-
let Attributes = [PrintfFormat<0>];
2757-
let Prototype = "int(char const*, ...)";
2758-
}
2759-
2760-
// FIXME: The builtin and library function should have the same signature.
2761-
def BuiltinPrintf : Builtin {
2762-
let Spellings = ["__builtin_printf"];
2763-
let Attributes = [NoThrow, PrintfFormat<0>, FunctionWithBuiltinPrefix];
2725+
let Attributes = [NoThrow, PrintfFormat<0>];
27642726
let Prototype = "int(char const* restrict, ...)";
27652727
}
27662728

@@ -3060,7 +3022,9 @@ def MemcCpy : GNULibBuiltin<"stdlib.h"> {
30603022

30613023
def MempCpy : GNULibBuiltin<"stdlib.h"> {
30623024
let Spellings = ["mempcpy"];
3025+
let Attributes = [NoThrow]
30633026
let Prototype = "void*(void*, void const*, size_t)";
3027+
let AddBuiltinPrefixedAlias = 1;
30643028
}
30653029

30663030
def StpCpy : GNULibBuiltin<"stdlib.h"> {
@@ -3121,17 +3085,11 @@ def Bcopy : GNULibBuiltin<"strings.h"> {
31213085
let AddBuiltinPrefixedAlias = 1;
31223086
}
31233087

3124-
// FIXME: This should be part of BCmp.
3125-
def BuiltinBCmp : Builtin {
3126-
let Spellings = ["__builtin_bcmp"];
3127-
let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Constexpr];
3128-
let Prototype = "int(void const*, void const*, size_t)";
3129-
}
3130-
31313088
def BCmp : GNULibBuiltin<"strings.h"> {
31323089
let Spellings = ["bcmp"];
3133-
let Attributes = [Constexpr];
3090+
let Attributes = [NoThrow, Constexpr];
31343091
let Prototype = "int(void const*, void const*, size_t)";
3092+
let AddBuiltinPrefixedAlias = 1;
31353093
}
31363094

31373095
def StrCaseCmp : GNULibBuiltin<"strings.h"> {

0 commit comments

Comments
 (0)