[cfe-dev] parse C++ throw

Mike Stump mrs at apple.com
Mon Feb 25 14:19:07 PST 2008


On Feb 24, 2008, at 8:24 PM, Chris Lattner wrote:
> +/// PraseThrowExpression - THis handles the C++ throw expression.
>
> Minor typos here: prase -> parse, THis -> This

Fixed.  Found one more instance of prase, fixed that as well.

> Tabs:
>
> +  virtual ExprResult ActOnCXXThrow(SourceLocation OpLoc,
> +				   ExprTy *Op = 0) {

Fixed all tabs.

> +  ///  CXXThrowExpr - [C++ 15] C++ Throw Expression.
> +  ///
> +  class CXXThrowExpr : public Expr {
> +    Expr *Op;
> +    SourceLocation Loc;
>
> I'd suggest renaming Loc -> ThrowLoc

Sure...  Fixed.

> In the comment, please say explicitly that this handles two cases  
> "throw;" in which case the operand is null, and "throw x;" in which  
> case x is the operand.

Done.  I added some more comments as well.

> This method:
> +    Expr *getSubExpr() const { return Op; }
>
> Should be replaced with these two:
> +    const Expr *getSubExpr() const { return Op; }
> +    Expr *getSubExpr() { return Op; }

I just copied CXXCastExpr, which didn't have it.  I'll submit a patch  
for that next.

I also added a FIXME for handling throw when not followed by a ';' nor  
an assignment-expression.  Something parser generators do  
automagically for us, but something we have to compute.  Do we have a  
tentative parse system yet or some other easy way to do this?  [ I  
think I know the answer, I bet not. ]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: eh-1a.diffs
Type: application/octet-stream
Size: 8346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080225/a5779335/attachment.obj>
-------------- next part --------------



More information about the cfe-dev mailing list