[cfe-dev] clang-tidy / static analysis

Maurizio Vitale via cfe-dev cfe-dev at lists.llvm.org
Sun Nov 12 13:54:20 PST 2017


Thanks. I didn't realize that some flow information is available in clang
tidy. All the example I saw were local matches of the AST.
But I see now that checks like
https://clang.llvm.org/extra/clang-tidy/checks/misc-use-after-move.html do
require analysis not dissimilar from what I need, so I now have something
to study.

On Sun, Nov 12, 2017 at 3:50 PM, Jonas Toth <jonas.toth at gmail.com> wrote:

> Hi,
>
> clang-tidy seems to be the correct point to start. It is made to rewrite
> source code and is easy to begin with.
>
> Take a look into the clang-tools-extra repository and browse the code,
> there are a lot of examples. There is a dedicated tutorial in the docs to
> get started as well.
>
> Am 12.11.2017 um 14:43 schrieb Maurizio Vitale via cfe-dev:
>
> hello clang clan,
>
>   I'm getting started with checkers and I have one in mind that I don't
> see a good way to implement.
>
> The idea is to find all uses of putenv and replace them w/ setenv. This
> requires analyzing the argument to discover constant parts in it (setenv
> require a separate variable name). It also require to check that the
> argument is not modified (or such modifications need also to be replaces w/
> setenvs).
>
> Is there a way to use the fixit infrastructure together with the static
> analyzer?
> If so, is it possible to make multiple changes part of the same fixit?
> What would be the recommended way of proceeding in this case? any similar
> checks/analysis I can take a look at?
>
> Thanks a lot,
>
>
>        Maurizio
>
>
> _______________________________________________
> cfe-dev mailing listcfe-dev at lists.llvm.orghttp://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/20171112/811619e5/attachment.html>


More information about the cfe-dev mailing list