[PATCH] D112850: [clang] 'unused-but-set-variable' warning should not apply to __block objective-c pointers

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 4 11:57:18 PDT 2021


ahatanak added a comment.

The lifetime of an object won't be extended in the following case since the variable isn't captured by a block:

  void foo(id);
  
  void test(id a) {
      __block id t = a;
      foo(a);
      t = 0;
  }

clang should probably warn if a variable marked `__block` isn't captured by a block, but I don't think `-Wunused-but-set-variable` should catch that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112850/new/

https://reviews.llvm.org/D112850



More information about the cfe-commits mailing list