[cfe-dev] Can I write a standalone static analyzer?
Artem Dergachev via cfe-dev
cfe-dev at lists.llvm.org
Thu Dec 14 11:14:07 PST 2017
I think what Matthew proposed is the best way to go. You can see
examples/analyzer-plugin in clang source tree - it compiles to a clang
plugin that you can load into existing clang binary in run-time with a
flag, and you can write your domain-specific checkers this way without
modifying clang directly.
If you explicitly want a standalone tool like clang-tidy, then note that
clang-tidy itself can run static analyzer checkers as well, including
path-sensitive checkers as well. What i don't know, however, is whether
you can load clang plugins from clang-tidy.
On 12/12/2017 1:49 AM, Matthew Del Buono via cfe-dev wrote:
> To further answer the question - I think meritozh may be saying "I
> wish I could write checkers without modifying the clang source code"
> to which the response is "you can!" You can compile your checker as a
> clang plugin to a shared object file and then load that plugin. That
> way there's no need to recompile clang, but you are still able to
> write your own custom checkers.
>
> You need to implement the clang_registerCheckers function in your
> plugin. See here:
> https://clang.llvm.org/doxygen/CheckerRegistry_8h_source.html
>
> Does that answer your question?
> -- Matthew P. Del Buono
>
> On Mon, Dec 11, 2017 at 11:27 PM, Alexey Knyshev via cfe-dev
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>
> Hi meritozh!
>
> CSA supports and encourage you to write custom opt-in checkers.
> Please explain what does mean "general purpose" statement and in
> which context you have to implement a new tool?
>
> Thanks, Alexey K
>
> 2017-12-12 9:33 GMT+03:00 gao ge via cfe-dev
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>>:
>
> Clang static analyzer is a great tool, but its checkers are
> only for general purpose. I want write some customized
> checkers. As I know, static analyzer is a port of clang,
> clang-tidy maybe a good choice, but it does not support path
> sensitive checker. It seems that I must modify clang source
> code? Can I write a standalone static analyzer which built on
> static analyzer module, but also support path sensitive checking?
>
> Thanks,
> meritozh
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>
>
>
>
> --
> linkedin.com/profile
> <https://www.linkedin.com/profile/view?id=AAMAABn6oKQBDhBteiQnWsYm-S9yxT7wQkfWhSw>
>
> github.com/alexeyknyshev <http://github.com/alexeyknyshev>
> bitbucket.org/alexeyknyshev <https://bitbucket.org/alexeyknyshev/>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list