[cfe-dev] Can I write a standalone static analyzer?

gao ge via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 12 19:29:29 PST 2017

Hi, thank you for your responses.

For Alexey, I have one method which can only be called in several special
methods. Or one property, it must have a rvalue in any path, Thera are not
general, I must do it by myself.

For Matthew, Clang Plugin is a better choice against modifying clang source
code directly, but a plugin must be compatible with clang libraries in ABI
level. Clang is a modern and modular project, so my question is, can I only
link with several clang libraries, produce one tool which can do static
analyze just like tools in clang-tools-extra? But it can also support path
sensitive checking.

By the way, why clang-tidy can not support invoke path sensitive checkers?

P.S.: English is not my mother language, sorry for my poor English : (

On Tue, Dec 12, 2017 at 5:49 PM Matthew Del Buono <mpdelbuono at gmail.com>

> 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> 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>:
>>> 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
>>> 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
>> bitbucket.org/alexeyknyshev
>> _______________________________________________
>> 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/20171213/a0458424/attachment.html>

More information about the cfe-dev mailing list