[PATCH] D41655: [clang-tidy] New check bugprone-unused-return-value

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 05:22:05 PST 2018


alexfh added inline comments.


================
Comment at: clang-tidy/bugprone/UnusedReturnValueCheck.cpp:45-48
+                            "^::std::async$|"
+                            "^::std::launder$|"
+                            "^::std::remove$|"
+                            "^::std::remove_if$|"
----------------
alexfh wrote:
> I strongly suspect that we could get away without regexs here. hasAnyName supports inline namespaces, so at least the first five entries here are covered. The main problem with std::unique_ptr<.*>::release is the need to match any template parameters. I *think*, we could adjust hasName to allow omitting template parameters (so that `std::unique_ptr::release` would match specializations of unique_ptr as well). The `empty` and `allocate` would need some research. Can we just list all specific classes where we care about `empty`? (Alternatively, can we match `empty` unqualified and check that it's somewhere inside `std`, but I don't like that much, since it would add inconsistency in how this check is configured.)
A clarification: we could go with your current version and optimize this part later. But the option may start being used by someone and then will change - that would be nice to avoid.

Alternatively, we could switch to hasAnyName right away and leave only the functions that can be easily supported, and then figure out what to do with `release`, `allocate` and `empty`.

I'd probably prefer the latter.


https://reviews.llvm.org/D41655





More information about the cfe-commits mailing list