[cfe-dev] organizing a clang static analyzer checker project

Artem Dergachev via cfe-dev cfe-dev at lists.llvm.org
Mon Jun 12 01:07:11 PDT 2017


I think Nick's -fplugin approach is equivalent to Stefan's -load 
approach, please correct me if i'm wrong :)

Stefan: i don't have much to present. I guess your main complication is 
Checkers.td which is a single registry of all checkers within the 
clang's executable. If only you could extend it to become more 
"modular", that'd probably help.

Probably you'd be happy with simply extending Checkers.td to look for 
checkers in directories other than lib/StaticAnalyzer/Checkers: eg. 
hardcode lib/StaticAnalyzer/ExternalCheckers, or even 
lib/StaticAnalyzer/Checkers/External, as an alternate path which would 
be your code repo.

On 6/10/17 1:18 AM, Nick Sumner via cfe-dev wrote:
> Dear Stefan,
>
> I've posted a demo here:
> https://github.com/nsumner/clang-plugins-demo
>
> This shows how you can make a standalone executable that automatically
> loads your own static analyzer plugins from your external project.
> I've not tried it out on Windows (and expect it to require tweaks),
> but it can point you along the way.
>
> Best,
> Nick
>
>
> On Mon, Jun 5, 2017 at 11:29 PM, Stefan Ciobaca via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
>> Dear Clang Developers,
>>
>> I am wondering about the best way to organize a project with several custom
>> Clang Static Analyzer checkers.
>>
>> Currently, we are compiling the custom checkers as plugins and load them
>> dynamically with -load on the command line. This has the benefit of having a
>> fast compile time, but it does not work (well) on Windows and it's not nice
>> for the end user.
>>
>> The standard way, to add them in llvm/tools/clang/lib/StaticAnalyzer as
>> described in https://clang-analyzer.llvm.org/checker_dev_manual.html, has
>> the downsides of (1) having a large compilation time and (2) being in a
>> place which is not directly under our source code control system.
>>
>> I am wondering if there is a third way to organize things. Ideally, we would
>> like to have
>> - fast compilation times;
>> - our checkers in a directory outside of the clang tree;
>> - easy on the end users (a static build of clang);
>> - our checkers working nicely on Windows.
>>
>> The llvm tree has a "projects" directory under which they recommend to place
>> external projects, but there are no guidelines on how to add CSA checkers
>> there.
>>
>> I would appreciate if you could provide some pointers on how to best
>> organize our project.
>>
>> Thank you!
>>
>> Best,
>> Stefan
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> 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