add parsing, ast building and pretty printing support for C++ throw expressions.
Patch by Mike Stump!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47582 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseExpr.cpp b/Parse/ParseExpr.cpp
index 67ce5f1..46714b7 100644
--- a/Parse/ParseExpr.cpp
+++ b/Parse/ParseExpr.cpp
@@ -157,6 +157,7 @@
/// assignment-expression: [C99 6.5.16]
/// conditional-expression
/// unary-expression assignment-operator assignment-expression
+/// [C++] throw-expression [C++ 15]
///
/// assignment-operator: one of
/// = *= /= %= += -= <<= >>= &= ^= |=
@@ -166,6 +167,9 @@
/// expression ',' assignment-expression
///
Parser::ExprResult Parser::ParseExpression() {
+ if (Tok.is(tok::kw_throw))
+ return ParseThrowExpression();
+
ExprResult LHS = ParseCastExpression(false);
if (LHS.isInvalid) return LHS;
@@ -187,6 +191,9 @@
/// ParseAssignmentExpression - Parse an expr that doesn't include commas.
///
Parser::ExprResult Parser::ParseAssignmentExpression() {
+ if (Tok.is(tok::kw_throw))
+ return ParseThrowExpression();
+
ExprResult LHS = ParseCastExpression(false);
if (LHS.isInvalid) return LHS;