NeKon69 wrote:

Just checked abseil source, it seems like you are defining them something like 
this:
```cpp
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::lifetime_capture_by)
#define ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY(Owner) \
  [[clang::lifetime_capture_by(Owner)]]
#else
#define ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY(Owner)
#endif
```
 I don't think there's an easy migration path for this, the only thing I can 
come up with is adding a new macro specifically for global/this/unknown (though 
maybe there's some C macro magic that I am not aware about). E.g. a separate 
macro for the this case that prefers the new spelling:
 ```cpp
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::lifetime_capture_by_this)
  #define ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY_THIS \
    [[clang::lifetime_capture_by_this]]
#elif ABSL_HAVE_CPP_ATTRIBUTE(clang::lifetime_capture_by)
  #define ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY_THIS \
    ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY(this)
#else
  #define ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY_THIS
#endif
```
Then use sites switch from `ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY(this)` to 
`ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY_THIS`.

https://github.com/llvm/llvm-project/pull/196635
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to