[clang] nolock/noalloc attributes (PR #84983)

Andrew Pinski via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 09:53:51 PDT 2024


pinskia wrote:

One question since the attribute is applied to types is there a way to get the nolock/noalloc from type?.
e.g.
```
template<class T> [[nolock(T)]] void f(T a) { a(); }
```
Will the above work or is there no way to implement that currently?


Since you mention it is attached to the type, is it mangled then differently. e.g.:
```
template<class T> [[nolock]] void f(T a) { a(); }
[[nolock(true)]] void g(void);
[[nolock(false)]] void h(void);
void m()
{
  f(g);
  f(h);
}
```
Does the above f calls to 2 different functions?
Or is the nolock/noalloc dropped from function types for templates/auto usage?
What about decltype (or the GNU extension __typeof__) usage is it dropped there too?

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


More information about the cfe-commits mailing list