[cfe-commits] r72279 - /cfe/trunk/lib/Parse/ParseExprCXX.cpp

Argiris Kirtzidis akyrtzi at gmail.com
Fri May 22 16:10:54 PDT 2009


Douglas Gregor wrote:
>
> On May 22, 2009, at 2:09 PM, Argiris Kirtzidis wrote:
>
>> Author: akirtzidis
>> Date: Fri May 22 16:09:47 2009
>> New Revision: 72279
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=72279&view=rev
>> Log:
>> The disambiguation process for ambiguous paren expressions is not 
>> "side effects free", e.g:
>>
>>  (T(*)(int[x+y]));
>>
>> is an (invalid) paren expression, but "x+y" will be parsed as part of 
>> the (rejected) type-id,
>> so unnecessary Action calls are made for an unused (and possibly 
>> leaked) "x+y".
>>
>> Use a different scheme, similar to parsing inline methods. The 
>> parenthesized tokens are cached,
>> the context that follows is determined (possibly by parsing a 
>> cast-expression),
>> and then we re-introduce the cached tokens into the token stream and 
>> parse them appropriately.
>
> Very nice! Can you think of any way to actually test this? Perhaps we 
> would end up getting a particular warning twice (once during 
> disambiguation, once later)?

Good idea! Commited a test case here: 
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090518/017586.html
This emits 2 warnings before rev 72279.

-Argiris



More information about the cfe-commits mailing list