[cfe-dev] clang-tidy vs. clang static analyzer
Alexander Kornienko via cfe-dev
cfe-dev at lists.llvm.org
Mon Sep 7 08:23:11 PDT 2015
http://clang.llvm.org/extra/clang-tidy/index.html#choosing-the-right-place-for-your-check
:
If you have an idea of a check, you should decide whether it should be
implemented as a:
- *Clang diagnostic*: if the check is generic enough, targets code
patterns that most probably are bugs (rather than style or readability
issues), can be implemented effectively and with extremely low false
positive rate, it may make a good Clang diagnostic.
- *Clang static analyzer check*: if the check requires some sort of
control flow analysis, it should probably be implemented as a static
analyzer check.
- *clang-tidy check* is a good choice for linter-style checks, checks
that are related to a certain coding style, checks that address code
readability, etc.
A few notable differences:
* clang-tidy supports fix-it hints, while static analyzer doesn't
* clang-tidy checks can operate AST and preprocessor information, while
Clang static analyzer checkers can additionally inspect control flow graph
and do path-based analysis, which allows for much
* static analyzer supports more advanced output formats (html, plist),
while clang-tidy supports only plain text and yaml (suitable for
clang-apply-replacements)
* if you're fine with plain text, clang-tidy can be used as a frontend
for the static analyzer checkers (they are called
clang-analyzer-<static-analyzer-checker-name>). This is probably the
overlap you were talking about.
-- Alex
On Fri, Sep 4, 2015 at 5:52 PM, Rob Conde via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> I was wondering if someone could comment on or point to any resources on
> the relationship between clang-tidy and the clang static analyzer as they
> seem to have overlap.
>
>
> Thanks,
>
> Rob Conde
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://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/20150907/ffce6dcc/attachment.html>
More information about the cfe-dev
mailing list