]> granicus.if.org Git - clang/commitdiff
simplify control flow by removing a goto.
authorChris Lattner <sabre@nondot.org>
Sun, 4 Jan 2009 22:28:21 +0000 (22:28 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Jan 2009 22:28:21 +0000 (22:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61641 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp

index f719b8914f50a155e83d203c26b8ba541b628154..f05119d7973e62e1c69d885f94e4c7e3aabb5bd7 100644 (file)
@@ -602,11 +602,13 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
   case tok::kw_float:
   case tok::kw_double:
   case tok::kw_void:
-  case tok::kw_typeof: {
-    if (!getLang().CPlusPlus)
-      goto UnhandledToken;
-  case tok::annot_qualtypename:
-    assert(getLang().CPlusPlus && "Expected C++");
+  case tok::kw_typeof:
+  case tok::annot_qualtypename: {
+    if (!getLang().CPlusPlus) {
+      Diag(Tok, diag::err_expected_expression);
+      return ExprError();
+    }
+    
     // postfix-expression: simple-type-specifier '(' expression-list[opt] ')'
     //
     DeclSpec DS;
@@ -657,9 +659,8 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
     // These can be followed by postfix-expr pieces.
     if (getLang().ObjC1)
       return ParsePostfixExpressionSuffix(ParseObjCMessageExpression());
-    // FALL THROUGH.
+    // FALL THROUGH.      
   default:
-  UnhandledToken:
     Diag(Tok, diag::err_expected_expression);
     return ExprError();
   }