[clang] [clang][Sema] Deprecate `global`/`unknown` in `lifetime_capture_by` (PR #196635)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 04:07:27 PDT 2026


Xazax-hun wrote:

> I guess we should add an explicit way to suppress these warnings, to handle cases where it's a third-party dependency whose code you don't control.

I am not sure if we actually need to do anything here. Your suggested migration path looks good to me, but alternatively one could also do:

```
#define MY_ANNOTATION \
    _Pragma("clang diagnostic push")                                             \
  _Pragma("clang diagnostic ignore  \"-Wdeprecated_capture_by_special_entity \"") \
  ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY_THIS \
  _Pragma("clang diagnostic pop") 
```

or something similar.

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


More information about the cfe-commits mailing list