Patch to parse objective-c's @try-statement and @throw-statement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42148 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp
index fb4fe1e..d37973b 100644
--- a/Parse/ParseStmt.cpp
+++ b/Parse/ParseStmt.cpp
@@ -75,22 +75,35 @@
   // Cases in this switch statement should fall through if the parser expects
   // the token to end in a semicolon (in which case SemiError should be set),
   // or they directly 'return;' if not.
-  switch (Tok.getKind()) {
+  tok::TokenKind Kind  = Tok.getKind();
+  SourceLocation AtLoc;
+  switch (Kind) {
   case tok::identifier:             // C99 6.8.1: labeled-statement
     // identifier ':' statement
     // declaration                  (if !OnlyStatement)
     // expression[opt] ';'
     return ParseIdentifierStatement(OnlyStatement);
 
+  case tok::at: // May be a @try or @throw statement
+    {
+      AtLoc = ConsumeToken();  // consume @
+      if (Tok.getIdentifierInfo()->getObjCKeywordID() == tok::objc_try)
+        return ParseObjCTryStmt(AtLoc);
+      else if (Tok.getIdentifierInfo()->getObjCKeywordID() == tok::objc_throw)
+        return ParseObjCThrowStmt(AtLoc);
+    }
+    // Fall thru.
+
   default:
-    if (!OnlyStatement && isDeclarationSpecifier()) {
+    if (Kind != tok::at && !OnlyStatement && isDeclarationSpecifier()) {
       return Actions.ActOnDeclStmt(ParseDeclaration(Declarator::BlockContext));
     } else if (Tok.getKind() == tok::r_brace) {
       Diag(Tok, diag::err_expected_statement);
       return true;
     } else {
       // expression[opt] ';'
-      ExprResult Res = ParseExpression();
+      ExprResult Res = (Kind == tok::at) ? ParseExpressionWithLeadingAt(AtLoc) 
+				         : ParseExpression();
       if (Res.isInvalid) {
         // If the expression is invalid, skip ahead to the next semicolon.  Not
         // doing this opens us up to the possibility of infinite loops if