[llvm] [IR] Add nofreeobj parameter/return attribute (PR #206445)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 08:05:56 PDT 2026


================
@@ -1587,6 +1587,27 @@ Currently, only the following parameter attributes are defined:
 
     This is not a valid attribute for return values.
 
+`nofreeobj`
+:   On arguments, this indicates that the underlying object of the argument
+    cannot be freed during the execution of the function (where "during" is in
+    the same sense as for `nofree`).
+
+    On return values, this indicates that the underlying object of the return
+    value cannot be freed from this point forward, for the duration of the
+    program's execution.
+
+    Unlike `nofree`, it is not possible to free the underlying object through
+    a different pointer either.
----------------
antoniofrighetto wrote:

Looks good, thanks!

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


More information about the llvm-commits mailing list