[cfe-commits] r140888 - /cfe/trunk/docs/InternalsManual.html

Sebastian Redl sebastian.redl at getdesigned.at
Sun Oct 2 13:04:25 PDT 2011


On 09/30/2011 11:32 PM, Douglas Gregor wrote:
> Author: dgregor
> Date: Fri Sep 30 16:32:37 2011
> New Revision: 140888
>
> URL: http://llvm.org/viewvc/llvm-project?rev=140888&view=rev
> Log:
> Add a section detailing the steps required to add an expression or
> statement to Clang.
>
> Modified:
>      cfe/trunk/docs/InternalsManual.html
>
> +<ol>
> +<li>Introduce parsing actions into the parser. Recursive-descent
> +  parsing is mostly self-explanatory, but there are a few things that
> +  are worth keeping in mind:
> +<ul>
> +<li>Keep as much source location information as possible! You'll
> +    want it later to produce great diagnostics and support Clang's
> +    various features that map between source code and the AST.</li>
> +<li>Write tests for all of the "bad" parsing cases, to make sure
> +    your recovery is good. If you have matched delimiters (e.g.,
> +    parentheses, square brackets, etc.), use
> +<tt>Parser::MatchRHSPunctuation</tt>  to give nice diagnostics when
> +    things go wrong.</li>
> +</ul>
> +</li>

Didn't we just have a big patch to replace MatchRHSPunctuation by some 
RTTI object?

> +
> +<li>Teach template instantiation how to cope with your AST
> +  node, which requires some fairly simple code:
> +<ul>
> +<li>Make sure that your expression's constructor properly
> +    computes the flags for type dependence (i.e., the type your
> +    expression produces can change from one instantiation to the
> +    next), value dependence (i.e., the constant value your expression
> +    produces can change from one instantiation to the next),
> +    instantiation dependence (i.e., a template parameter or occurs
> +    anywhere in your expression),
"template parameter or occurs" -- or what?

Sebastian



More information about the cfe-commits mailing list