[clang] [Clang] Introduce malloc_span attribute (PR #167010)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 18 05:48:37 PST 2025
================
@@ -3449,6 +3449,24 @@ def err_attribute_integers_only : Error<
def warn_attribute_return_pointers_only : Warning<
"%0 attribute only applies to return values that are pointers">,
InGroup<IgnoredAttributes>;
+def warn_attribute_return_span_only
+ : Warning<"%0 attribute only applies to functions that return span-like "
+ "structures">,
+ InGroup<IgnoredAttributes>;
+def note_returned_not_struct : Note<"returned type is not a struct/class type">;
+def note_returned_incomplete_type : Note<"returned type is incomplete">;
+def note_returned_not_two_field_struct
+ : Note<"returned struct/class has %0 fields, expected 2">;
+def note_returned_not_span_struct
+ : Note<"returned struct/class fields are not a supported combination for a "
+ "span-like type (expected pointer/integer or pointer/pointer)">;
+def note_returned_not_integer_field
+ : Note<"field #%0 expected to be an integer">;
+def note_returned_not_wide_enough_field
+ : Note<"integer field #%0 of span-like type is not wide enough (minimum "
----------------
AaronBallman wrote:
Instead of using `field #%0`, you should use `%ordinal0` to print "1st", "2nd", "3rd", etc and reword accordingly.
https://github.com/llvm/llvm-project/pull/167010
More information about the cfe-commits
mailing list