[clang] [clang-repl] Address error recovery fixing infinite loop while parsing (PR #127569)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 11 02:23:30 PST 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,h -- clang/test/Interpreter/repl-input-end-recovery.cpp clang/include/clang/Parse/Parser.h clang/lib/Parse/ParseCXXInlineMethods.cpp clang/lib/Parse/ParseDecl.cpp clang/lib/Parse/ParseDeclCXX.cpp clang/lib/Parse/ParseExprCXX.cpp clang/lib/Parse/ParseHLSL.cpp clang/lib/Parse/ParseObjc.cpp clang/lib/Parse/ParseOpenMP.cpp clang/lib/Parse/ParsePragma.cpp clang/lib/Parse/ParseStmt.cpp clang/lib/Parse/Parser.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/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 182a5f368..80353de0a 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -519,12 +519,12 @@ public:
bool SkipUntil(ArrayRef<tok::TokenKind> Toks,
SkipUntilFlags Flags = static_cast<SkipUntilFlags>(0));
- /// Determine if the given token marks the end of the current partial translation unit.
- /// In incremental (REPL) mode, this checks for annot_repl_input_end.
- /// In normal compilation, this checks for EOF.
+ /// Determine if the given token marks the end of the current partial
+ /// translation unit. In incremental (REPL) mode, this checks for
+ /// annot_repl_input_end. In normal compilation, this checks for EOF.
static bool isAtInputEnd(const Token &T, const LangOptions &LO) {
return T.is(tok::eof) ||
- (LO.IncrementalExtensions && T.is(tok::annot_repl_input_end));
+ (LO.IncrementalExtensions && T.is(tok::annot_repl_input_end));
}
private:
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
index 2119a2935..3347d8976 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -2823,8 +2823,7 @@ void PragmaSupportHandler<StartTok, EndTok, UnexpectedDiag>::HandlePragma(
Tok.setKind(StartTok);
Tok.setLocation(Introducer.Loc);
- while (Tok.isNot(tok::eod) &&
- !Parser::isAtInputEnd(Tok, PP.getLangOpts())) {
+ while (Tok.isNot(tok::eod) && !Parser::isAtInputEnd(Tok, PP.getLangOpts())) {
Pragma.push_back(Tok);
PP.Lex(Tok);
if (Tok.is(StartTok)) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/127569
More information about the cfe-commits
mailing list