[cfe-dev] parse C++ throw

Chris Lattner clattner at apple.com
Mon Feb 25 16:52:45 PST 2008


On Feb 25, 2008, at 3:37 PM, Mike Stump wrote:
>> +void StmtPrinter::VisitCXXThrowExpr(CXXThrowExpr *Node) {
>> +  OS << "throw ";
>> +  if (Node->getSubExpr())
>> +    PrintExpr(Node->getSubExpr());
>>
>> It would be slightly nicer to not print the space after the throw  
>> if subexpr is null.
>
> Yeah, I thought about doing that when I first implemented it and  
> decided against worrying about it as it didn't seem as bad as the  
> extra {} in extern "C" handling.  But, it is easy, localized and  
> doesn't require any more data in the AST to do it, sooo....  Fixed.

Yeah I agree that it's not a big issue :)

>> I don't think there are any cases where a declaration is allowed  
>> after a throw,
>
> You mean like this:
>
>  throw int(1);
>
> ?  Yup, that's valid.

yuck.  Ok.

>> so this predicate should be relatively straight-forward, something  
>> like Parser::isDeclarationSpecifier().
>>
>> I agree this is somewhat ugly, but it could be worse
>
> Just wait, we'll get there.

Applied, thanks Mike!
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080225/004439.html

-Chris



More information about the cfe-dev mailing list