[cfe-dev] RFC: Pumping Clang-Tidy warnings through the Static Analyzer's BugReporter.

Dmitri Gribenko via cfe-dev cfe-dev at lists.llvm.org
Fri Sep 6 06:44:01 PDT 2019


On Wed, Sep 4, 2019 at 1:17 AM Artem Dergachev <noqnoqneo at gmail.com> wrote:
> Clang-Tidy doesn't really need BugReporter; all it needs is
> PathDiagnosticConsumer. (the word "Path" is rudimentary)
>
> It should be perfectly comfortable to build PathDiagnostics by hand - it
> maps nicely to how you already build your warnings and notes.

I like this approach better, however, I also think that
PathDiagnostic's API is a lot more complex than the current `diag()
<<` in ClangTidy. For example, it requires the caller to specify the
checker name. It also requires to specify a ton of locations and
decls, whereas we can probably infer most of the locations and decls
from just one location.

Again, something I would really like to see written down (and us agree
upon) is the data model for a diagnostic. When we know what data we
need to store, we can figure out how to store it, and a convenient API
to populate it.

Dmitri

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list