[PATCH] D138583: Create unused non-trivially-destructible check in clang-tidy

Andrei via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 24 07:46:28 PST 2022


ankineri added a comment.

I do agree that having it as part of `-Wunused-variable` is better on many aspects, but I have a few concerns about it.
The proposed check can be applied to any type including STL ones such as `std::string`, all as per codebase owner's choice. Adding this attribute to STL classes will probably be really hard as it will break many builds.
Having `warn_unused absl::Status` (and a couple of others) is probably a good idea anyway, but is it feasible to apply it to STL?

In other words, this check is:

- Configurable per build (which types to check for)
- Applicable to types of libraries not owned by the developer
- Likely breaking far fewer build targets
- Is decoupled from trivially-destructible objects (i.e. with `-Wunused-variable` types like `int` fall into the same category as `[[warn_unused]]`-marked ones).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138583



More information about the cfe-commits mailing list