[PATCH] D120372: [clang] 'unused-but-set-variable' warning should not apply to __attribute__((objc_precise_lifetime) Objective-C pointers

Michael Wyman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 22 19:04:01 PST 2022


mwyman added inline comments.


================
Comment at: clang/test/SemaObjC/objc-precise-lifetime-unused-variable.m:7
+  // no diagnostics for objects with precise lifetime semantics.
+  __attribute__((objc_precise_lifetime)) id x;
+  x = getFoo();
----------------
dmaclach wrote:
> what happens in the case that x is never assigned to anything? Do we still get a warning?
The code implementing `-Wunused-variable` checking already explicitly excludes `objc_precise_lifetime`-attributed variables: https://github.com/llvm/llvm-project/blob/36e335eeb577b6dc559de3a66bc832afae1f56c4/clang/lib/Sema/SemaDecl.cpp#L1847


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120372



More information about the cfe-commits mailing list