[clang] [clang][Parser] Preserve LHS in RecoveryExpr for binary operations statement boundaries. (PR #192535)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 22:17:30 PDT 2026


================
@@ -540,7 +542,11 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
 
     if (!LHS.isInvalid()) {
       // Combine the LHS and RHS into the LHS (e.g. build AST).
-      if (TernaryMiddle.isInvalid()) {
+      if (RHS.isInvalid()) {
+        LHS = Actions.CreateRecoveryExpr(LHS.get()->getBeginLoc(),
----------------
HighCommander4 wrote:

The test case added to ast-dump-recovery.cpp seems to provide appropriate test coverage. Did you have something different in mind?

https://github.com/llvm/llvm-project/pull/192535


More information about the cfe-commits mailing list