[cfe-commits] r41638 - /cfe/trunk/Parse/ParseExpr.cpp
Chris Lattner
sabre at nondot.org
Thu Aug 30 22:01:51 PDT 2007
Author: lattner
Date: Fri Aug 31 00:01:50 2007
New Revision: 41638
URL: http://llvm.org/viewvc/llvm-project?rev=41638&view=rev
Log:
don't turn semantic errors into parse errors.
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=41638&r1=41637&r2=41638&view=diff
==============================================================================
--- cfe/trunk/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/Parse/ParseExpr.cpp Fri Aug 31 00:01:50 2007
@@ -374,15 +374,19 @@
}
assert(NextTokPrec <= ThisPrec && "Recursion didn't work!");
- // Combine the LHS and RHS into the LHS (e.g. build AST).
- if (TernaryMiddle.isInvalid)
- LHS = Actions.ParseBinOp(OpToken.getLocation(), OpToken.getKind(),
- LHS.Val, RHS.Val);
- else
- LHS = Actions.ParseConditionalOp(OpToken.getLocation(), ColonLoc,
- LHS.Val, TernaryMiddle.Val, RHS.Val);
- if (LHS.isInvalid)
- return LHS;
+ if (!LHS.isInvalid) {
+ // Combine the LHS and RHS into the LHS (e.g. build AST).
+ if (TernaryMiddle.isInvalid)
+ LHS = Actions.ParseBinOp(OpToken.getLocation(), OpToken.getKind(),
+ LHS.Val, RHS.Val);
+ else
+ LHS = Actions.ParseConditionalOp(OpToken.getLocation(), ColonLoc,
+ LHS.Val, TernaryMiddle.Val, RHS.Val);
+ } else {
+ // We had a semantic error on the LHS. Just free the RHS and continue.
+ Actions.DeleteExpr(TernaryMiddle.Val);
+ Actions.DeleteExpr(RHS.Val);
+ }
}
}
More information about the cfe-commits
mailing list