[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

Doug Wyatt via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 13:36:58 PDT 2024


dougsonos wrote:

> ```
> #include <cstdlib>
> float* nb4() noexcept [[clang::nonallocating]]
> {
>   float* ptr = (float*)malloc(100 * sizeof(float));
>   return ptr;
> }
> ```
> 
> Produces no warnings:

Hi Chris,
Thanks. That turned out to be the impetus to start carving out exceptions to "built-in functions are always safe", since the `malloc` obtained by `cstdlib` gets recognized as a built-in. Pushed a first crack at handling that.

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


More information about the cfe-commits mailing list