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

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:26:17 PDT 2007


Author: sabre
Date: Wed Jul 11 11:26:16 2007
New Revision: 38961

URL: http://llvm.org/viewvc/llvm-project?rev=38961&view=rev
Log:
Parse ?:'s right

Modified:
    cfe/cfe/trunk/Parse/ParseExpr.cpp

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

==============================================================================
--- cfe/cfe/trunk/Parse/ParseExpr.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseExpr.cpp Wed Jul 11 11:26:16 2007
@@ -305,7 +305,7 @@
     ConsumeToken();
     
     // Special case handling for the ternary operator.
-    ExprResult TernaryMiddle;
+    ExprResult TernaryMiddle(true);
     if (NextTokPrec == prec::Conditional) {
       if (Tok.getKind() != tok::colon) {
         // Handle this production specially:
@@ -361,7 +361,7 @@
     assert(NextTokPrec <= ThisPrec && "Recursion didn't work!");
   
     // Combine the LHS and RHS into the LHS (e.g. build AST).
-    if (NextTokPrec != prec::Conditional)
+    if (TernaryMiddle.isInvalid)
       LHS = Actions.ParseBinOp(OpToken, LHS.Val, RHS.Val);
     else
       LHS = Actions.ParseConditionalOp(OpToken.getLocation(), ColonLoc,





More information about the cfe-commits mailing list