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

Nico Weber via cfe-dev cfe-dev at lists.llvm.org
Fri Sep 6 10:45:12 PDT 2019


Sorry about the delayed reply, I only saw this thread when it popped up
again today.

On Wed, Aug 14, 2019 at 7:37 PM Artem Dergachev via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> On 8/14/19 9:20 AM, Reid Kleckner wrote:
>
> On Wed, Aug 14, 2019 at 12:24 AM Dmitri Gribenko via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> I would like to suggest something different: move Clang Static
>> Analyzer to clang-tools-extra. Build it either as a separate binary or
>> compile it into the clang-tidy binary. Then let `clang -analyze`
>> delegate to that binary for backwards compatibility.
>>
>
> Speaking as an outsider in the peanut gallery who does very little static
> analysis, this is very appealing to me. It would save binary size in clang
> and make building and testing clang faster, if the developer isn't working
> in the static analyzer space.
>
> A bit +1 to this from me as well.

>
> Generally we already have a cmake flag for this,
> -DCLANG_ENABLE_STATIC_ANALYZER=OFF (defaults to ON). This flag is
> definitely a must-have for people who try to make their clang binary as
> tiny as possible. But i understand that this flag is not exceptionally
> discoverable and a lot of people probably suffer unnecessarily long compile
> times simply because they didn't discover it.
>

I'm aware of this flag, but it doesn't quite do what I want: I want
clang-tidy to have the static analyzer, but I don't want my compiler to
have it. It'd be nice if there was a setting that allowed putting the
analyzer in clang-tidy but not in clang, and to make `clang -analyze` shell
out to clang-tidy for backwards compat.

I agree that the analyzer is in the compiler mainly for historical reasons,
and that we wouldn't move it form clang-tidy into the compiler if it was
only in clang-tidy. This suggests that that's the future we should work
towards.


>
> That said, i suspect that unless you work exclusively on CodeGen, you
> probably do not want to turn off the Static Analyzer, because the Static
> Analyzer has some interesting tests that you can accidentally break when
> you work on anything else (Preprocessor, Lexer, AST, Sema...). In
> particular, Richard Smith regularly touches our code :)
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190906/0ecf2633/attachment.html>


More information about the cfe-dev mailing list