[clang] [clang][Parser] Preserve LHS in RecoveryExpr for binary operations statement boundaries. (PR #192535)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 20 06:43:19 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang/lib/Parse/ParseExpr.cpp clang/test/AST/ast-dump-recovery.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index aacefb1a5..437f8408a 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -544,8 +544,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
// Combine the LHS and RHS into the LHS (e.g. build AST).
if (RHS.isInvalid()) {
LHS = Actions.CreateRecoveryExpr(LHS.get()->getBeginLoc(),
- PrevTokLocation,
- {LHS.get()});
+ PrevTokLocation, {LHS.get()});
} else if (TernaryMiddle.isInvalid()) {
// If we're using '>>' as an operator within a template
// argument list (in C++98), suggest the addition of
``````````
</details>
https://github.com/llvm/llvm-project/pull/192535
More information about the cfe-commits
mailing list