[clang] [Clang] Permit noescape on non-pointer types (PR #117344)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 05:59:53 PST 2024


Xazax-hun wrote:

> I want to see something that shows that the attribute is actually DOING something on non-pointer types.

I added a test to make sure the attribute is actually applied to the AST. Admittedly, there is not a lot that this can be used for as of now (other than documenting the intent that a parameter should not escape). But this is something that we want to rely on extensively in our downstream fork in Swift to support safer interop between C, C++ and Swift. I also suspect that this can be potentially useful information for generating ergonomic/safe bindings for Rust or other memory safe languages as well. 

This attribute also come up in https://discourse.llvm.org/t/rfc-a-clangir-based-safe-c/83245

Let me know if this makes sense. Otherwise, we could keep this change in our downstream fork until more work is accumulated for this attribute to do something. 

> Also, requires a release note.

Done.

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


More information about the cfe-commits mailing list