diff clang/lib/Parse/ParseExpr.cpp @ 209:dd44ba33042e

merged...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:36:09 +0900
parents 2e18cbf3894f de4ac79aef9d
children 9e61cd3a874d
line wrap: on
line diff
--- a/clang/lib/Parse/ParseExpr.cpp	Tue Jun 08 06:08:56 2021 +0900
+++ b/clang/lib/Parse/ParseExpr.cpp	Tue Jun 08 06:36:09 2021 +0900
@@ -1143,6 +1143,12 @@
       }
     }
 
+#ifndef noCbC
+    if(NeedPrototypeDeclaration(Tok)){
+      CreatePrototypeDeclaration();
+    }
+#endif
+
     // Consume the identifier so that we can see if it is followed by a '(' or
     // '.'.
     IdentifierInfo &II = *Tok.getIdentifierInfo();
@@ -1522,6 +1528,9 @@
   case tok::kw__Float16:
   case tok::kw___float128:
   case tok::kw_void:
+#ifndef noCbC
+  case tok::kw___code:
+#endif
   case tok::kw_typename:
   case tok::kw_typeof:
   case tok::kw___vector:
@@ -1732,6 +1741,14 @@
                                    PreferredType.get(Tok.getLocation()));
     return ExprError();
   }
+#ifndef noCbC
+  case tok::kw__CbC_return:
+    Res = Prepare__retForGotoWithTheEnvExpr();
+    break;
+  case tok::kw__CbC_environment:
+    Res = Prepare__envForGotoWithTheEnvExpr();
+    break;
+#endif
   case tok::l_square:
     if (getLangOpts().CPlusPlus11) {
       if (getLangOpts().ObjC) {
@@ -3364,7 +3381,20 @@
     if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
       Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
       Expr = ParseBraceInitializer();
-    } else
+    }
+#ifndef noCbC
+    else if (Tok.is(tok::kw__CbC_return)){
+      Expr = Prepare__retForGotoWithTheEnvExpr();
+    }
+    else if (Tok.is(tok::kw__CbC_environment)){
+      Expr = Prepare__envForGotoWithTheEnvExpr();
+    }
+    else if (Tok.is(tok::identifier) && NeedPrototypeDeclaration(Tok)){ // check code segment declaration.
+      CreatePrototypeDeclaration();
+      Expr = ParseAssignmentExpression();
+    }
+#endif
+    else
       Expr = ParseAssignmentExpression();
 
     if (Tok.is(tok::ellipsis))