[cfe-commits] r41607 - /cfe/trunk/Parse/ParseExpr.cpp

Chris Lattner sabre at nondot.org
Thu Aug 30 08:52:49 PDT 2007


Author: lattner
Date: Thu Aug 30 10:52:49 2007
New Revision: 41607

URL: http://llvm.org/viewvc/llvm-project?rev=41607&view=rev
Log:
make sure to parse postfix expression suffixes after builtin
primary expressions.

Modified:
    cfe/trunk/Parse/ParseExpr.cpp

Modified: cfe/trunk/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseExpr.cpp?rev=41607&r1=41606&r2=41607&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/Parse/ParseExpr.cpp Thu Aug 30 10:52:49 2007
@@ -771,6 +771,8 @@
       return ExprResult(true);
 
     ParseTypeName();
+    
+    MatchRHSPunctuation(tok::r_paren, LParenLoc);
     break;
     
   case tok::kw___builtin_offsetof: {
@@ -824,8 +826,9 @@
         Comps.back().LocEnd =
           MatchRHSPunctuation(tok::r_square, Comps.back().LocStart);
       } else if (Tok.getKind() == tok::r_paren) {
-        return Actions.ParseBuiltinOffsetOf(StartLoc, Ty, &Comps[0],
-                                            Comps.size(), ConsumeParen());
+        Res = Actions.ParseBuiltinOffsetOf(StartLoc, Ty, &Comps[0],
+                                           Comps.size(), ConsumeParen());
+        break;
       } else {
         // Error occurred.
         return ExprResult(true);
@@ -859,8 +862,9 @@
       Diag(Tok, diag::err_expected_rparen);
       return ExprResult(true);
     }
-    return Actions.ParseChooseExpr(StartLoc, Cond.Val, Expr1.Val, Expr2.Val,
-                                   ConsumeParen());
+    Res = Actions.ParseChooseExpr(StartLoc, Cond.Val, Expr1.Val, Expr2.Val,
+                                  ConsumeParen());
+    break;
   }
   case tok::kw___builtin_types_compatible_p:
     TypeTy *Ty1 = ParseTypeName();
@@ -874,11 +878,10 @@
       Diag(Tok, diag::err_expected_rparen);
       return ExprResult(true);
     }
-    return Actions.ParseTypesCompatibleExpr(StartLoc, Ty1, Ty2, ConsumeParen());
+    Res = Actions.ParseTypesCompatibleExpr(StartLoc, Ty1, Ty2, ConsumeParen());
+    break;
   }      
   
-  MatchRHSPunctuation(tok::r_paren, LParenLoc);
-  
   // These can be followed by postfix-expr pieces because they are
   // primary-expressions.
   return ParsePostfixExpressionSuffix(Res);





More information about the cfe-commits mailing list