On Sep 10, 2010, at 2:18 PM, Eli Friedman wrote: > On Fri, Sep 10, 2010 at 1:55 PM, Sebastian Redl > <[email protected]> wrote: >> Author: cornedbee >> Date: Fri Sep 10 15:55:37 2010 >> New Revision: 113622 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=113622&view=rev >> Log: >> Parse the noexcept operator and stub out sema. >> >> Modified: cfe/trunk/lib/Parse/ParseExpr.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=113622&r1=113621&r2=113622&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Parse/ParseExpr.cpp (original) >> +++ cfe/trunk/lib/Parse/ParseExpr.cpp Fri Sep 10 15:55:37 2010 >> @@ -457,6 +457,7 @@ >> /// [GNU] '&&' identifier >> /// [C++] new-expression >> /// [C++] delete-expression >> +/// [C++0x] 'noexcept' '(' expression ')' >> /// >> /// unary-operator: one of >> /// '&' '*' '+' '-' '~' '!' >> @@ -546,9 +547,9 @@ >> /// '__is_base_of' [TODO] >> /// >> ExprResult Parser::ParseCastExpression(bool isUnaryExpression, >> - bool >> isAddressOfOperand, >> - bool &NotCastExpr, >> - ParsedType TypeOfCast) >> { >> + bool isAddressOfOperand, >> + bool &NotCastExpr, >> + ParsedType TypeOfCast) { >> ExprResult Res; >> tok::TokenKind SavedKind = Tok.getKind(); >> NotCastExpr = false; >> @@ -891,6 +892,19 @@ >> case tok::kw_delete: // [C++] delete-expression >> return ParseCXXDeleteExpression(false, Tok.getLocation()); >> >> + case tok::kw_noexcept: { // [C++0x] 'noexcept' '(' expression ')' >> + SourceLocation KeyLoc = ConsumeToken(); >> + SourceLocation LParen = Tok.getLocation(); >> + if (ExpectAndConsume(tok::l_paren, >> + diag::err_expected_lparen_after, "noexcept")) >> + return ExprError(); >> + ExprResult Result = ParseExpression(); >> + SourceLocation RParen = MatchRHSPunctuation(tok::r_paren, LParen); >> + if (!Result.isInvalid()) >> + Result = Actions.ActOnNoexceptExpr(KeyLoc, LParen, Result.take(), >> RParen); >> + return move(Result); >> + } >> + >> case tok::kw___is_pod: // [GNU] unary-type-trait >> case tok::kw___is_class: >> case tok::kw___is_enum: > > Don't you need an EnterExpressionEvaluationContext here?
Probably. I have to admit that the whole evaluation context thing confuses me. But calling these from the parser makes sense. Sebastian _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
