[PATCH] D33365: [clang-tidy] misc-assertion-count: A New Check

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 8 02:33:57 PDT 2017


lebedev.ri added a comment.

In https://reviews.llvm.org/D33365#775860, @alexfh wrote:

> I guess, this check should go to `readability` or elsewhere, but definitely not to `misc`.


Hmm, `misc` may be a bad place for this, but i think `readability` is even worse fit.
The best guess would be something like `hardening` / `security`, but there is no such category.

> Another big question is whether it's reasonable to set up specific ratio limits on the density of asserts. I think, density of asserts strongly depends on the nature of the code, and there is no single answer to how much asserts should be used. IIUC, neither of the recommendations you mentioned contain any quantitative measures, they just delegate the decision to the developer.

No, it is not reasonable to set up **default** ratio limits on the density of asserts.
That is exactly why the default params are NOP, and i even made sure that if the params are NOP, this check will not add any overhead (no PPCallback, no matchers).

Did that answer your question?

> I'm not saying it's impossible to find good formalization of these rules, but I'd expect some sort of analysis of existing codebases with regard to how asserts are used (not just the density of asserts, but also positioning of asserts and what is being checked by the asserts) in different types of code.


Repository:
  rL LLVM

https://reviews.llvm.org/D33365





More information about the cfe-commits mailing list