[cfe-commits] r140888 - /cfe/trunk/docs/InternalsManual.html
dgregor at apple.com
Thu Oct 13 17:57:42 PDT 2011
On Oct 2, 2011, at 1:04 PM, Sebastian Redl wrote:
> 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
>> Add a section detailing the steps required to add an expression or
>> statement to Clang.
>> +<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:
>> +<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>
> Didn't we just have a big patch to replace MatchRHSPunctuation by some
> RTTI object?
I updated this text along with that patch.
>> +<li>Teach template instantiation how to cope with your AST
>> + node, which requires some fairly simple code:
>> +<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?
Ah, sorry. Fixed.
More information about the cfe-commits