ankineri requested review of this revision.
ankineri added a comment.

`-Wunused-variable` does not detect unused non-trivially-destructible objects 
because they may be used for RAII, i.e.

  {
    scoped_lock lock(&global_mutex);
    critical_section();
  }

`lock` here is not an unused variable because its destructor side-effects are 
its usage. However if replaced with say `absl::Status` or even `std::string` it 
will be more or less obvious that the variable is unused, but the warning will 
still not be triggered (as both `absl::Status` and `std::string` have 
nontrivial destructors). This is where this checks is useful: for 
non-trivially-destructible types known not to be used in RAII.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138583

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to