[cfe-dev] How could I implement mygcc's Checking with Clang?‏

Manuel Klimek klimek at google.com
Tue Aug 21 09:06:51 PDT 2012


On Tue, Aug 21, 2012 at 4:30 AM, yang yeping <yangyeping_666 at hotmail.com> wrote:
> I am a post-graduate student from Beijing Institute of Technology in China
> and I am a newcomer to llvm/Clang and I am so interested at it.I have read
> Nic Volanschi's Papers about Mygcc[1] and Condate[2].
> In my opinion, this is a great job. Now I want to implement this Checking
> ability with Clang.But I find something different between gcc and Clang:
> 1. The ASTs are so different
> 2. As far as I know, Clang does not use a GIMPLE internal representation
> 3. May other differences(As I am not familiar with Clang and gcc)
>
> And another question:
>  How to transplant the condate.y parser to Clang?
>
> So I want to know whether my idea is feasible.
> If it is feasible, how could I solve the problems above?And Could anyone
> give me some suggestion about  implementing mygcc's Checking with Clang?For
> example, make use of ! ASTMatcher interface?
>
> By the way, I have visited the mail of Samuel Harrington at
> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-April/008599.html
>
> Despite of this, I still want to know more about implementing the Checking
> ability with clang.

Very high level answer:
You can use clang plugins to add checks to clang
(http://clang.llvm.org/docs/ClangPlugins.html).
The AST matchers can help you finding certain patterns you'd like to
detect (I'm working on more docs there); you can also use the
RecursiveASTVisitor directly
(http://clang.llvm.org/docs/RAVFrontendAction.html)

Cheers,
/Manuel


>
> Thanks for your patient.
>
> [1] http://mygcc.free.fr/
> [2] http://mygcc.free.fr/condate-asej07.pdf
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list