<div dir="ltr"><div><div>Many thanks for the details, Jordan.<br><br>Now new questions arise:<br><br>1)From your comments, may I conclude that checker-plugins are not in the current development path for Clang/Analyzer? Is that path currently somehow frozen?<br>
<br></div><div></div><div>2) What additional "actions" could be perfomed on an AST? I can only think of programatically modifying the AST, i.e., programatically changing the source code to make it, for example, compliant with coding rules or the like. Any other uses? I'm still (in the process of) becoming more familiar with this.<br>
<br></div><div>3) You say that plugins can also add additional checkers. From the example you mention (MainCallChecker.cpp) and from the documentation in CheckerRegistry.h, what do you exactly mean by "add"? Are you referring to the fact that you register the checker? Am I right if I conclude that if a plugin adds several checkers, these are packed/compiled in the same final DLL for the plugin, and, thus, that's why the plugin needs loading to be able to use its checkers? (in this last case, would it be necessary to rebuild Clang as with a normal checker? I guess it wouldn't).<br>
</div><div><br></div>Thanks a lot for your reply.<br></div>Aitor.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-24 19:09 GMT+02:00 Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>That's not <i>quite</i> the distinction, but it's probably close enough for your purposes.</div>
<div><br></div><div>In Clang, "plugin" means a shared library (DLL, .so, .dylib) that can be loaded by the compiler. The most common use of plugins is to provide additional "actions" to perform on an AST after it has been parsed; the '-plugin' flag is used to select which plugin actions to run. See <a href="http://clang.llvm.org/docs/ClangPlugins.html" target="_blank">http://clang.llvm.org/docs/ClangPlugins.html</a> and the PrintFunctionNames plugin in the examples/ directory.</div>
<div><br></div><div>A "checker" is used by the analyzer to improve knowledge about the program it's analyzing; it's a sort of visitor that can get callbacks for each expression that gets evaluated. The analyzer has a number of built-in checkers, just like the compiler has several built-in AST actions. Plugins (i.e. loaded libraries) can also add additional checkers, though support for this is a bit brittle.* The only real documentation on this is in include/clang/StaticAnalyzer/Core/CheckerRegistry.h, plus the tiny checker plugin in the examples/ directory.</div>
<div><br></div><div>Hope that helps clear things up a bit.</div><div>Jordan</div><div><br></div><div>* I was the one who added support for checker plugins many years ago (before joining Apple), but no one's really taken ownership in the past few years. We're pretty much just keeping the existing support limping along, no improvements.</div>
<div><br></div><br><div><div><div class="h5"><div>On Apr 21, 2014, at 4:53 , Aitor San Juan <<a href="mailto:aitor.sj@opendeusto.es" target="_blank">aitor.sj@opendeusto.es</a>> wrote:</div><br></div></div><blockquote type="cite">
<div><div class="h5"><div dir="ltr"><div>Reading the docs through carefully, I have realized that plugins are used by the compiler, whereas checkers are used by the analyzer. Sorry for such a trivial question.<br></div><div>
Cheers.<br></div><div>
<br>2014-04-19 13:43 GMT+02:00 Aitor San Juan <span dir="ltr"><<a href="mailto:aitor.sj@opendeusto.es" target="_blank">aitor.sj@opendeusto.es</a>></span>:<br><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div dir="ltr"><div><div><span style="font-family:georgia,serif">Hello,<br><br></span></div><span style="font-family:georgia,serif">I was wondering the difference between the concept of a plugin and a checker. Please, correct me. As far as I know, from a technical point of view, a plugin is a separately compiled routine (DLL) that may be loaded by the compiler (compile-time). However, a checker is a routine used by Clang's analyzer to enhance the latter's analysis logic (in the case of  a checker, in order for the analyzer to be able to use it, the latter must be rebuilt).<br>


<br></span></div><span style="font-family:georgia,serif">I also wonder whether a plugin can also interact with Clang's analyzer? If so, then what reason could make you decide whether to implement a checker or a plugin?<br>


</span><div><div class="gmail_extra"><span style="font-family:georgia,serif"><br></span></div><div class="gmail_extra"><span style="font-family:georgia,serif">Thanks.<span><font color="#888888"><br></font></span></span></div>

<span><font color="#888888"><div class="gmail_extra"><span style="font-family:georgia,serif">Aitor.</span><br>
</div></font></span></div></div>
</blockquote></div><br></div></div></div></div></div></div>
_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></blockquote></div><br></div>