[PATCH] D55433: [clang-tidy] Adding a new modernize use nodiscard checker

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 7 11:00:17 PST 2018


lebedev.ri added a comment.

In D55433#1323145 <https://reviews.llvm.org/D55433#1323145>, @MyDeveloperDay wrote:

> In D55433#1323106 <https://reviews.llvm.org/D55433#1323106>, @lebedev.ri wrote:
>
> > Have you evaluated this on some major C++ projects yet?
> >  I suspect this may have pretty low SNR.
>
>
> Internally yes (on millions of lines), but you are correct high noise level,


... and the examples of the most common noise are?
Please run it on some codebase (llvm?) with run-clang-tidy.py, and post the results.

> however resulting compiles showed a number of hard to find bugs most notably where empty()  function on custom container was being used when they meant clear(), this bug had gone undetected for 10+ years.

That does sound good.

> The idea came from guidance given in Jason Turner @lefticus  CppCon2018 talk, https://www.youtube.com/watch?v=DHOlsEd0eDE (about 14 minutes in)
> 
> "is it a logical error in your code to call this member function and discard the return value"... the room says yes!!




Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D55433





More information about the cfe-commits mailing list