diff options
| author | Faisal Vali <faisalv@yahoo.com> | 2017-04-01 21:30:49 +0000 |
|---|---|---|
| committer | Faisal Vali <faisalv@yahoo.com> | 2017-04-01 21:30:49 +0000 |
| commit | d143a0c2de1311575633de3c6a3f55b101889229 (patch) | |
| tree | c2e69d0ca1363f458b6be56e8b478b8e45f3e8de /clang/lib/Parse/ParseExpr.cpp | |
| parent | 1a3665bb828c28781ade8252a40d6d5a682fcd66 (diff) | |
| download | bcm5719-llvm-d143a0c2de1311575633de3c6a3f55b101889229.tar.gz bcm5719-llvm-d143a0c2de1311575633de3c6a3f55b101889229.zip | |
[NFC, Scoped Enum] Convert Sema::ExpressionEvaluationContext into a scoped Enum
- also replace direct equality checks against the ConstantEvaluated enumerator with isConstantEvaluted(), in anticipation of adding finer granularity to the various ConstantEvaluated contexts and reinstating certain restrictions on where lambda expressions can occur in C++17.
- update the clang tablegen backend that uses these Enumerators, and add the relevant scope where needed.
llvm-svn: 299316
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
| -rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index ed7b8f33fc0..6a81da753b1 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -198,8 +198,8 @@ ExprResult Parser::ParseConstantExpression(TypeCastState isTypeCast) { // An expression is potentially evaluated unless it appears where an // integral constant expression is required (see 5.19) [...]. // C++98 and C++11 have no such rule, but this is only a defect in C++98. - EnterExpressionEvaluationContext ConstantEvaluated(Actions, - Sema::ConstantEvaluated); + EnterExpressionEvaluationContext ConstantEvaluated( + Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated); ExprResult LHS(ParseCastExpression(false, false, isTypeCast)); ExprResult Res(ParseRHSOfBinaryExpression(LHS, prec::Conditional)); @@ -1313,7 +1313,8 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // C++11 [expr.unary.noexcept]p1: // The noexcept operator determines whether the evaluation of its operand, // which is an unevaluated operand, can throw an exception. - EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated); + EnterExpressionEvaluationContext Unevaluated( + Actions, Sema::ExpressionEvaluationContext::Unevaluated); ExprResult Result = ParseExpression(); T.consumeClose(); @@ -1882,9 +1883,10 @@ ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() { if (!Name) return ExprError(); - - EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated, - Sema::ReuseLambdaContextDecl); + + EnterExpressionEvaluationContext Unevaluated( + Actions, Sema::ExpressionEvaluationContext::Unevaluated, + Sema::ReuseLambdaContextDecl); return Actions.ActOnSizeofParameterPackExpr(getCurScope(), OpTok.getLocation(), @@ -1895,8 +1897,9 @@ ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() { if (OpTok.isOneOf(tok::kw_alignof, tok::kw__Alignof)) Diag(OpTok, diag::warn_cxx98_compat_alignof); - EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated, - Sema::ReuseLambdaContextDecl); + EnterExpressionEvaluationContext Unevaluated( + Actions, Sema::ExpressionEvaluationContext::Unevaluated, + Sema::ReuseLambdaContextDecl); bool isCastExpr; ParsedType CastTy; @@ -2569,7 +2572,8 @@ ExprResult Parser::ParseGenericSelectionExpression() { { // C11 6.5.1.1p3 "The controlling expression of a generic selection is // not evaluated." - EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated); + EnterExpressionEvaluationContext Unevaluated( + Actions, Sema::ExpressionEvaluationContext::Unevaluated); ControllingExpr = Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression()); if (ControllingExpr.isInvalid()) { |

