[cfe-dev] [clang-tidy] RFC: "Experimental" checkers

via cfe-dev cfe-dev at lists.llvm.org
Fri Apr 10 01:11:15 PDT 2020

Since no-one picked this up, I’ll just comment although I’m not deeply involved. Maybe this will trigger someone else.


I personally like the idea in general. While there is a risk of stuff being experimental forever there is also more feedback and more contributions that way compared to those checkers being hidden somewhere privately.

Also I agree on the stability comments. It doesn’t make sense to add rules so bad that they just crash. The goal should be to collect real feedback, real bug reports, etc.


I’m also thinking of the const adding checker (Sorry I forgot the name), which had like 0,1% false positives and therefore cannot be declared fully ‘working’ yet (as far as I remember).

With that checker being easily available to more people maybe some simpler cases with false positives will emerge which are easier to analyze.


The other questions I leave to the experts ;-)






Von: cfe-dev <cfe-dev-bounces at lists.llvm.org> Im Auftrag von Whisperity via cfe-dev
Gesendet: Mittwoch, 25. März 2020 13:32
An: via cfe-dev <cfe-dev at lists.llvm.org>; aaron at aaronballman.com
Betreff: [cfe-dev] [clang-tidy] RFC: "Experimental" checkers


Dear List, 


This is a generic interest pitch mail about adding the notion of "experimental" checks to Clang-Tidy.


(A *very* rudimentary patch about the experimental group is here: http://reviews.llvm.org/D76545.) 


The reason behind this idea is from the discussion with Aaron on a check that I developed and proposing for the suite. Review *of the check* here: http://reviews.llvm.org/D69560.


Summary (of the experimental idea):

 - Certain rules (such as the one mentioned above) cannot (yet?) be implemented properly, due to various constraints

 - However, parts of the rule that *could* be implemented might turn out to be useful for the community

 - It's not nice to "sell" a checker named "foo-bar" if it only does "bar" partially — but coming up with a different name is superfluous as we wish to convey the intent that we support "bar" fully later on.


The Clang Static Analyser people have a similar notion of "alpha.", however, several concerns about modelling that approach for Tidy has been expressed, namely:

 - the lifespan of checkers in the alpha. group is too long for Tidy's(?) taste

 - alpha checkers are allowed to have crashes, lots of false positives, senseless output, etc.

 - it's generally a "you're on your own" situation if you decide to run alpha checkers


It's understandable that we wish to be something more stable, but this needs more input from a broader set of people.


I believe that requiring stability (i.e. no crashes in general, or performance issues) from upstramed experimental checkers is a good idea. The core idea of an experimental checker could be:


"Here's a rule, it's a nice rule, here's an automated tool for that, let's see what it does on live projects. This can help us develop further, or maybe even do rounds of revising/extending the rule/best practice itself!"




First things first: main group, or subgroup?

We could organise the situation in two ways:

 - Having a top level group "experimental-<originally targeted group>-checker-name"

 - Or having a "subgroup" under each main group: "<originally targeted group>-experimental-checker-name"


In the latter case, I believe *not* turning on experimental checks unless the user explicitly requests (in some fashion) is necessary.


There're a few key bureaucracy points that need to be discussed before moving forward:


 1. What's the accepted quality level for a patch to be merged as an experimental check? Where is the line between full-size checker, vs. an experimental?

 2. What's the life cycle concerns involved by experimental checkers?


Remember, that checkers merged into upstream will be "sold" as an LLVM feature.


For 1., I think (and hopefully this is a somewhat neutral point of view argument, even though it's my patch) that the checker I'm proposing (http://reviews.llvm.org/D69560) is a good example. There's a well-defined idea, and a large part of the implementation *works* in practice. (And - hopefully - there's a small amount of weird crashes here and there, I've did my best to eliminate what I could.)


For 2., I'm with more lack of words. To reiterate a claim from the review of the "new group idea": In ClangSA, there are alpha checkers that had been there for years, but so far never made out of alpha, whereas requiring constant maintenance (at least to the point of making sure an internal API break is patched into them...) 

"We don't want 'experimental-' to become a dumping ground for bad quality checks."


There should be at least the general idea that we can, in the future, declare the experiment to have failed (for whatever reason, be it lack of interest, change of winds, or technical issues), and eventually deprecate and remove the related check.

The other path, where the experiment is a success is easier, hopefully a simple rename (and some aliasing) can solve it.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200410/bd96733b/attachment-0001.html>

More information about the cfe-dev mailing list