[cfe-commits] r113622 - in /cfe/trunk: include/clang/Basic/TokenKinds.def include/clang/Sema/Sema.h lib/Parse/ParseExpr.cpp lib/Sema/SemaExprCXX.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Fri Sep 10 14:28:29 PDT 2010
On Sep 10, 2010, at 2:18 PM, Eli Friedman wrote:
> On Fri, Sep 10, 2010 at 1:55 PM, Sebastian Redl
> <sebastian.redl at getdesigned.at> 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
More information about the cfe-commits
mailing list