AaronBallman wrote:
> > Given this is a keyword, maybe we should consider not deprecating that, and
> > only deprecate things that actually conflict with identifiers.
>
> I would also be OK with keeping `this` as an argument to the attribute. I
> wonder what @AaronBallman 's take is on this.
I don't have strong opinions on `lifetime_capture_by(this)` vs
`lifetime_capture_by_this`. The lifetime analysis is useful in C but C has no
member functions and so I'm not worried about the lack of a `this` keyword in C
here.
That said, I would have expected this to be written on the member function
itself given that it's supposedly a type attribute. e.g.,
```
struct S {
void func(int *ptr) [[clang::lifetime_captures(ptr)]];
void other_func(int *ptr);
};
```
because I would have expected diagnostics here:
```
void (S::*ptr)(int *p) = &S::func; // Error, loses important lifetime capturing
information
void (S::*ptr)(int *p) [[clang::lifetime_captures(p)]] = &S::func; // Warning?
Picks up lifetime capturing but that seems harmless?
```
However, it currently has no type semantics despite being written in a type
position, so it probably should have been a declaration attribute instead, but
that's an even more disruptive design change.
https://github.com/llvm/llvm-project/pull/196635
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits