@@ -1014,6 +1014,22 @@ def err_ptrauth_indirect_goto_addrlabel_arithmetic : Error<
10141014 "%select{subtraction|addition}0 of address-of-label expressions is not "
10151015 "supported with ptrauth indirect gotos">;
10161016
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+
10171033/// main()
10181034// static main() is not an error in C, just in C++.
10191035def warn_static_main : Warning<"'main' should not be declared static">,
@@ -3923,7 +3939,8 @@ def note_cannot_use_trivial_abi_reason : Note<
39233939 "its copy constructors and move constructors are all deleted|"
39243940 "it is polymorphic|"
39253941 "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">;
39273944
39283945// Availability attribute
39293946def warn_availability_unknown_platform : Warning<
@@ -5021,6 +5038,10 @@ def note_ovl_candidate_bad_ownership : Note<
50215038 "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
50225039 " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
50235040 "__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">;
50245045def note_ovl_candidate_bad_cvr_this : Note<
50255046 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
50265047 "'this' argument has type %3, but method is not marked "
@@ -6092,7 +6113,7 @@ def note_deleted_special_member_class_subobject : Note<
60926113 "%select{default|corresponding|default|default|default}4 constructor}0|"
60936114 "destructor}5"
60946115 "%select{||s||}4"
6095- "|is an ObjC pointer}6">;
6116+ "|is an ObjC pointer|has an address-discriminated '__ptrauth' qualifier }6">;
60966117def note_default_constructed_field
60976118 : Note<"default constructed field %0 declared here">;
60986119def note_deleted_default_ctor_uninit_field : Note<
@@ -8938,6 +8959,19 @@ def err_typecheck_incompatible_ownership : Error<
89388959 "sending to parameter of different type}0,1"
89398960 "|%diff{casting $ to type $|casting between types}0,1}2"
89408961 " 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">;
89418975def err_typecheck_comparison_of_distinct_blocks : Error<
89428976 "comparison of distinct block types%diff{ ($ and $)|}0,1">;
89438977
@@ -9066,6 +9100,9 @@ def err_atomic_op_needs_non_const_atomic : Error<
90669100def err_atomic_op_needs_non_const_pointer : Error<
90679101 "address argument to atomic operation must be a pointer to non-const "
90689102 "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)">;
90699106def err_atomic_op_needs_trivial_copy : Error<
90709107 "address argument to atomic operation must be a pointer to a "
90719108 "trivially-copyable type (%0 invalid)">;
@@ -9343,6 +9380,8 @@ def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
93439380 "pointer/integer type mismatch in conditional expression"
93449381 "%diff{ ($ and $)|}0,1">,
93459382 InGroup<DiagGroup<"conditional-type-mismatch">>;
9383+ def err_typecheck_cond_incompatible_ptrauth : Error<
9384+ "'__ptrauth' qualification mismatch%diff{ ($ and $)|}0,1">;
93469385def err_typecheck_choose_expr_requires_constant : Error<
93479386 "'__builtin_choose_expr' requires a constant expression">;
93489387def warn_unused_expr : Warning<"expression result unused">,
0 commit comments