@@ -1014,6 +1014,22 @@ def err_ptrauth_indirect_goto_addrlabel_arithmetic : Error<
1014
1014
"%select{subtraction|addition}0 of address-of-label expressions is not "
1015
1015
"supported with ptrauth indirect gotos">;
1016
1016
1017
+ // __ptrauth qualifier
1018
+ def err_ptrauth_qualifier_invalid : Error<
1019
+ "%select{return type|parameter type|property}1 may not be qualified with '__ptrauth'; type is %0">;
1020
+ def err_ptrauth_qualifier_cast : Error<
1021
+ "cannot cast to '__ptrauth'-qualified type %0">;
1022
+ def err_ptrauth_qualifier_nonpointer : Error<
1023
+ "'__ptrauth' qualifier only applies to pointer types; %0 is invalid">;
1024
+ def err_ptrauth_qualifier_redundant : Error<
1025
+ "type %0 is already %1-qualified">;
1026
+ def err_ptrauth_arg_not_ice : Error<
1027
+ "argument to '__ptrauth' must be an integer constant expression">;
1028
+ def err_ptrauth_address_discrimination_invalid : Error<
1029
+ "invalid address discrimination flag '%0'; '__ptrauth' requires '0' or '1'">;
1030
+ def err_ptrauth_extra_discriminator_invalid : Error<
1031
+ "invalid extra discriminator flag '%0'; '__ptrauth' requires a value between '0' and '%1'">;
1032
+
1017
1033
/// main()
1018
1034
// static main() is not an error in C, just in C++.
1019
1035
def warn_static_main : Warning<"'main' should not be declared static">,
@@ -3923,7 +3939,8 @@ def note_cannot_use_trivial_abi_reason : Note<
3923
3939
"its copy constructors and move constructors are all deleted|"
3924
3940
"it is polymorphic|"
3925
3941
"it has a base of a non-trivial class type|it has a virtual base|"
3926
- "it has a __weak field|it has a field of a non-trivial class type}1">;
3942
+ "it has a __weak field|it has a field of a non-trivial class type|"
3943
+ "it has an address-discriminated '__ptrauth' field}1">;
3927
3944
3928
3945
// Availability attribute
3929
3946
def warn_availability_unknown_platform : Warning<
@@ -5021,6 +5038,10 @@ def note_ovl_candidate_bad_ownership : Note<
5021
5038
"%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
5022
5039
" but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
5023
5040
"__autoreleasing}5 ownership">;
5041
+ def note_ovl_candidate_bad_ptrauth : Note<
5042
+ "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5043
+ "%ordinal8 argument (%3) has %select{no '__ptrauth'|%5}4 qualifier,"
5044
+ " but parameter has %select{no '__ptrauth'|%7}6 qualifier">;
5024
5045
def note_ovl_candidate_bad_cvr_this : Note<
5025
5046
"candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
5026
5047
"'this' argument has type %3, but method is not marked "
@@ -6092,7 +6113,7 @@ def note_deleted_special_member_class_subobject : Note<
6092
6113
"%select{default|corresponding|default|default|default}4 constructor}0|"
6093
6114
"destructor}5"
6094
6115
"%select{||s||}4"
6095
- "|is an ObjC pointer}6">;
6116
+ "|is an ObjC pointer|has an address-discriminated '__ptrauth' qualifier }6">;
6096
6117
def note_default_constructed_field
6097
6118
: Note<"default constructed field %0 declared here">;
6098
6119
def note_deleted_default_ctor_uninit_field : Note<
@@ -8938,6 +8959,19 @@ def err_typecheck_incompatible_ownership : Error<
8938
8959
"sending to parameter of different type}0,1"
8939
8960
"|%diff{casting $ to type $|casting between types}0,1}2"
8940
8961
" changes retain/release properties of pointer">;
8962
+ def err_typecheck_incompatible_ptrauth : Error<
8963
+ "%enum_select<AssignmentAction>{%Assigning{%diff{assigning $ to $|assigning to different types}1,0}"
8964
+ "|%Passing{%diff{passing $ to parameter of type $|"
8965
+ "passing to parameter of different type}0,1}"
8966
+ "|%Returning{%diff{returning $ from a function with result type $|"
8967
+ "returning from function with different return type}0,1}"
8968
+ "|%Converting{%diff{converting $ to type $|converting between types}0,1}"
8969
+ "|%Initializing{%diff{initializing $ with an expression of type $|"
8970
+ "initializing with expression of different type}0,1}"
8971
+ "|%Sending{%diff{sending $ to parameter of type $|"
8972
+ "sending to parameter of different type}0,1}"
8973
+ "|%Casting{%diff{casting $ to type $|casting between types}0,1}}2"
8974
+ " changes pointer authentication of pointee type">;
8941
8975
def err_typecheck_comparison_of_distinct_blocks : Error<
8942
8976
"comparison of distinct block types%diff{ ($ and $)|}0,1">;
8943
8977
@@ -9066,6 +9100,9 @@ def err_atomic_op_needs_non_const_atomic : Error<
9066
9100
def err_atomic_op_needs_non_const_pointer : Error<
9067
9101
"address argument to atomic operation must be a pointer to non-const "
9068
9102
"type (%0 invalid)">;
9103
+ def err_atomic_op_needs_non_address_discriminated_pointer : Error<
9104
+ "address argument to %select{atomic|__sync}0 operation must be a pointer to a non address discriminated "
9105
+ "type (%1 invalid)">;
9069
9106
def err_atomic_op_needs_trivial_copy : Error<
9070
9107
"address argument to atomic operation must be a pointer to a "
9071
9108
"trivially-copyable type (%0 invalid)">;
@@ -9343,6 +9380,8 @@ def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
9343
9380
"pointer/integer type mismatch in conditional expression"
9344
9381
"%diff{ ($ and $)|}0,1">,
9345
9382
InGroup<DiagGroup<"conditional-type-mismatch">>;
9383
+ def err_typecheck_cond_incompatible_ptrauth : Error<
9384
+ "'__ptrauth' qualification mismatch%diff{ ($ and $)|}0,1">;
9346
9385
def err_typecheck_choose_expr_requires_constant : Error<
9347
9386
"'__builtin_choose_expr' requires a constant expression">;
9348
9387
def warn_unused_expr : Warning<"expression result unused">,
0 commit comments