On Dec 2, 2008, at 8:35 AM, Sebastian Redl wrote:

> Author: cornedbee
> Date: Tue Dec  2 10:35:44 2008
> New Revision: 60421
>
> URL: http://llvm.org/viewvc/llvm-project?rev=60421&view=rev
> Log:
> Make the parser handle ::new and ::delete correctly.

Looks good, thanks!

> +  case tok::coloncolon: // [C++] new-expression or [C++] delete- 
> expression
> +    if (NextToken().is(tok::kw_new))
> +      return ParseCXXNewExpression();
> +    else
> +      return ParseCXXDeleteExpression();
> +

It's worth a comment here noting that '::' followed by anything but  
"new" or "delete" will be resolved to a scope-resolution or qualified  
typename token.

>
>   case tok::kw_new: // [C++] new-expression
> -    // FIXME: ParseCXXIdExpression currently steals :: tokens.
>     return ParseCXXNewExpression();
>
>   case tok::kw_delete: // [C++] delete-expression
>
> Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=60421&r1=60420&r2=60421&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Tue Dec  2 10:35:44 2008
> @@ -38,6 +38,12 @@
>       (Tok.isNot(tok::identifier) || NextToken().isNot 
> (tok::coloncolon)))
>     return false;
>
> +  // Don't parse ::new and ::delete as scope specifiers. It would  
> only make
> +  // things a lot more complicated.
> +  if (Tok.is(tok::coloncolon) && (NextToken().is(tok::kw_new) ||
> +                                  NextToken().is(tok::kw_delete)))
> +    return false;

It's not that parsing ::new and ::delete here would be more  
complicated, it's that they aren't nested-name-specifiers at all, right?

Thanks, Sebastian!

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to