[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">;
----------------
AaronBallman wrote:

```suggestion
def note_returned_not_struct : Note<"returned type is not a struct/class type">;
```
Instead of `struct/class` all over the place, let's just pick one and go with `struct type` (because this is used in C as well as C++). WDYT?

https://github.com/llvm/llvm-project/pull/167010


More information about the cfe-commits mailing list