<div dir="ltr">No, clang-tidy can not load clang plugin right now, but there is a tracking issue, <a href="https://bugs.llvm.org//show_bug.cgi?id=32739">https://bugs.llvm.org//show_bug.cgi?id=32739</a>.<div>Finally, after trade-off, writing checker as plugin is the best way for me.</div><div><br></div><div>Thank you very much.</div><div><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 15, 2017 at 3:15 AM Artem Dergachev via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think what Matthew proposed is the best way to go. You can see<br>
examples/analyzer-plugin in clang source tree - it compiles to a clang<br>
plugin that you can load into existing clang binary in run-time with a<br>
flag, and you can write your domain-specific checkers this way without<br>
modifying clang directly.<br>
<br>
If you explicitly want a standalone tool like clang-tidy, then note that<br>
clang-tidy itself can run static analyzer checkers as well, including<br>
path-sensitive checkers as well. What i don't know, however, is whether<br>
you can load clang plugins from clang-tidy.<br>
<br>
On 12/12/2017 1:49 AM, Matthew Del Buono via cfe-dev wrote:<br>
> To further answer the question - I think meritozh may be saying "I<br>
> wish I could write checkers without modifying the clang source code"<br>
> to which the response is "you can!" You can compile your checker as a<br>
> clang plugin to a shared object file and then load that plugin. That<br>
> way there's no need to recompile clang, but you are still able to<br>
> write your own custom checkers.<br>
><br>
> You need to implement the clang_registerCheckers function in your<br>
> plugin. See here:<br>
> <a href="https://clang.llvm.org/doxygen/CheckerRegistry_8h_source.html" rel="noreferrer" target="_blank">https://clang.llvm.org/doxygen/CheckerRegistry_8h_source.html</a><br>
><br>
> Does that answer your question?<br>
> -- Matthew P. Del Buono<br>
><br>
> On Mon, Dec 11, 2017 at 11:27 PM, Alexey Knyshev via cfe-dev<br>
> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>>> wrote:<br>
><br>
> Hi meritozh!<br>
><br>
> CSA supports and encourage you to write custom opt-in checkers.<br>
> Please explain what does mean "general purpose" statement and in<br>
> which context you have to implement a new tool?<br>
><br>
> Thanks, Alexey K<br>
><br>
> 2017-12-12 9:33 GMT+03:00 gao ge via cfe-dev<br>
> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>>>:<br>
><br>
> Clang static analyzer is a great tool, but its checkers are<br>
> only for general purpose. I want write some customized<br>
> checkers. As I know, static analyzer is a port of clang,<br>
> clang-tidy maybe a good choice, but it does not support path<br>
> sensitive checker. It seems that I must modify clang source<br>
> code? Can I write a standalone static analyzer which built on<br>
> static analyzer module, but also support path sensitive checking?<br>
><br>
> Thanks,<br>
> meritozh<br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
> <<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>><br>
><br>
><br>
><br>
><br>
> --<br>
> <a href="http://linkedin.com/profile" rel="noreferrer" target="_blank">linkedin.com/profile</a><br>
> <<a href="https://www.linkedin.com/profile/view?id=AAMAABn6oKQBDhBteiQnWsYm-S9yxT7wQkfWhSw" rel="noreferrer" target="_blank">https://www.linkedin.com/profile/view?id=AAMAABn6oKQBDhBteiQnWsYm-S9yxT7wQkfWhSw</a>><br>
><br>
> <a href="http://github.com/alexeyknyshev" rel="noreferrer" target="_blank">github.com/alexeyknyshev</a> <<a href="http://github.com/alexeyknyshev" rel="noreferrer" target="_blank">http://github.com/alexeyknyshev</a>><br>
> <a href="http://bitbucket.org/alexeyknyshev" rel="noreferrer" target="_blank">bitbucket.org/alexeyknyshev</a> <<a href="https://bitbucket.org/alexeyknyshev/" rel="noreferrer" target="_blank">https://bitbucket.org/alexeyknyshev/</a>><br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
> <<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div></div>