[cfe-commits] [PATCH] loading external plugins with scan-build
Thomas Hauth
Thomas.Hauth at cern.ch
Thu May 24 11:49:14 PDT 2012
Hi Anna,
thanks for pointing that problem out. Indeed, "-Xlang" must be
"-Xclang". I did test the "scan-build --help" functionality and the
plugin checkers show up in the list of available checkers as expected.
However, the code in question checks for the checkers which are enabled
by default ( in the clang compile). As plugin checkers are not enabled
by default, I missed this problem.
To test the correct code, I temporarily added my custom plugin to
lib/Driver/Tools.cpp as default and it now shows up as "enabled" as
expected. In the course of this investigation, I discovered a possible
bug in the scan-build code. Plugins which have a "nested" path ( like
security.insecureAPI.getpw, enabled in Tools.cpp:1498 by default) are
not correctly detected as enabled. Run "scan-build" and
"security.insecureAPI.getpw" shows up, but without the "+" item to mark
it is enabled as default.
I fixed both incidents in the patch attached to this mail.
Greetings,
Thomas
On 05/24/12 12:48, Anna Zaks wrote:
> Thanks Thomas.
>
> Did you test scan-build help?
>
> +# create a list to load the plugins via the 'Xlang' command line
> +# argument
> +my @PluginLoadCommandline_xlang;
> +foreach my $param ( @PluginsToLoad ) {
> + push ( @PluginLoadCommandline_xlang, "-Xlang" );
> + push ( @PluginLoadCommandline_xlang, $param );
> +}
>
> Shouldn't "Xlang" be "Xclang"?
>
> Thanks,
> Anna.
>
> On May 24, 2012, at 6:43 AM, Thomas Hauth wrote:
>
>> Hello,
>> following the discussion on the clang list:
>> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-May/021491.html
>>
>> I prepared a patch to load custom plugins when running scan-build. This is useful when additional static analysis Checkers must be provided via clang's plugin interface.
>>
>> Loading additional plugins can now be done via the scan-build call:
>> scan-build -load-plugin<plugin.so>
>>
>> Please review the attached patch.
>>
>> Thanks,
>> Thomas Hauth
>> <clang_patch_scan-build_plugins.diff>_______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
--
------------------------------------------------------------------------
Thomas Hauth
CERN
Office: 40 3 B20
Telephone: +41 (0)22 76 71 557
------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_patch_scan-build_plugins_v2.diff
Type: text/x-patch
Size: 3194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120524/b9ef8f76/attachment.bin>
More information about the cfe-commits
mailing list