summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
diff options
context:
space:
mode:
authorHubert Tong <hubert.reinterpretcast@gmail.com>2015-06-25 00:23:39 +0000
committerHubert Tong <hubert.reinterpretcast@gmail.com>2015-06-25 00:23:39 +0000
commitec3cb573f522cf6748eae8afa5b33f9b65c33d6e (patch)
tree2198fc7989005e81e19307e2c1214fff7284ae37 /clang/lib/Parse/ParseExpr.cpp
parent6a75acb1c2fde67614d86084d09f9debc0425d67 (diff)
downloadbcm5719-llvm-ec3cb573f522cf6748eae8afa5b33f9b65c33d6e.tar.gz
bcm5719-llvm-ec3cb573f522cf6748eae8afa5b33f9b65c33d6e.zip
[Concepts] Parsing of requires-clause in template-declaration
Summary: This change implements parse-only acceptance of the optional requires-clause in a template-declaration. Diagnostic testing is added for cases where the grammar is ambiguous with the expectation that the longest token sequence which matches the syntax of a constraint-expression is consumed without backtracking. Reviewers: faisalv, fraggamuffin, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D10462 llvm-svn: 240611
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r--clang/lib/Parse/ParseExpr.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index da759c76522..36a302e52e6 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -205,6 +205,24 @@ ExprResult Parser::ParseConstantExpression(TypeCastState isTypeCast) {
return Actions.ActOnConstantExpression(Res);
}
+/// \brief Parse a constraint-expression.
+///
+/// \verbatim
+/// constraint-expression: [Concepts TS temp.constr.decl p1]
+/// logical-or-expression
+/// \endverbatim
+ExprResult Parser::ParseConstraintExpression() {
+ // FIXME: this may erroneously consume a function-body as the braced
+ // initializer list of a compound literal
+ //
+ // FIXME: this may erroneously consume a parenthesized rvalue reference
+ // declarator as a parenthesized address-of-label expression
+ ExprResult LHS(ParseCastExpression(/*isUnaryExpression=*/false));
+ ExprResult Res(ParseRHSOfBinaryExpression(LHS, prec::LogicalOr));
+
+ return Res;
+}
+
bool Parser::isNotExpressionStart() {
tok::TokenKind K = Tok.getKind();
if (K == tok::l_brace || K == tok::r_brace ||
OpenPOWER on IntegriCloud