[clang] [clang][lex] Fix lexing malformed pragma within include directive (PR #138165)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 1 18:44:03 PDT 2025


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 HEAD~1 HEAD --extensions cpp -- clang/lib/Lex/Pragma.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp
index 607e7b6a7..ea7eda0d0 100644
--- a/clang/lib/Lex/Pragma.cpp
+++ b/clang/lib/Lex/Pragma.cpp
@@ -222,10 +222,8 @@ void Preprocessor::Handle_Pragma(Token &Tok) {
     // Skip bad tokens, and the ')', if present.
     if (Tok.isNot(tok::r_paren) && Tok.isNot(tok::eof) && Tok.isNot(tok::eod))
       Lex(Tok);
-    while (Tok.isNot(tok::r_paren) &&
-           !Tok.isAtStartOfLine() &&
-           Tok.isNot(tok::eof) &&
-           Tok.isNot(tok::eod))
+    while (Tok.isNot(tok::r_paren) && !Tok.isAtStartOfLine() &&
+           Tok.isNot(tok::eof) && Tok.isNot(tok::eod))
       Lex(Tok);
     if (Tok.is(tok::r_paren))
       Lex(Tok);

``````````

</details>


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


More information about the cfe-commits mailing list