On Tuesday, February 14, 2017 at 3:25:05 AM UTC+11, Ehsan Akhgari wrote:
> On 2017-02-11 3:27 AM, ISHIKAWA,chiaki wrote:
> > On 2017/02/11 7:07, Botond Ballo wrote:
> >> On Fri, Feb 10, 2017 at 3:45 PM, Milan Sreckovic
> >> <msrec...@mozilla.com> wrote:
> >>> First step needs to happen completely before the second step does, so I
> >>> guess the danger is that we start and give up before we get to step
> >>> 2.  I
> >>> don't think that will happen, but it is something we should always think
> >>> about.
> >>
> >> It may be possible to automate most if not all of step 1 using an
> >> automated refactoring based on clang's AST matchers (the same thing
> >> our static analyses are based on). Then we could do step 1 all at
> >> once, and even do before/after performance comparisons before
> >> committing to it. Worth exploring, I think.
> >>
> > 
> > Is there any document about the AST matchers, especially about the
> > analyzer that does "static analyses" for mozilla code?
> > 
> > For example, I found the following URL:
> > https://clang.llvm.org/docs/LibASTMatchersTutorial.html
> 
> This reference documents all of the built-in matchers:
> <http://clang.llvm.org/docs/LibASTMatchersReference.html>.  The page
> above is a good place to start.  I also have a blog post that explains
> how to create a simple static analysis check where I talk about AST
> matchers among other things:
> <https://ehsanakhgari.org/blog/2015-12-07/c-static-analysis-using-clang>.
>  There are other good blog posts and code samples to be found by doing a
> web/github search.
> 
> Cheers,
> Ehsan

And clang-query is your best friend! It saved me days of debugging-by-Try for 
my second matcher. :-)
More info there:
http://eli.thegreenplace.net/2014/07/29/ast-matchers-and-clang-refactoring-tools

Also http://gcc.godbolt.org/ using clang with compiler option: '-Xclang 
-ast-dump', to quickly work out how some code translates to ASTs.

Cheers,
Gerald
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to