[clang] [clang][Sema] Fix the continue and break scope for while loops (PR #152606)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 14 01:55:17 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,c -- clang/test/Sema/loop-condition-continue-scopes.c clang/lib/CodeGen/CGStmt.cpp clang/lib/Parse/ParseExprCXX.cpp clang/lib/Parse/ParseStmt.cpp clang/test/CoverageMapping/break.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 93de30ac7..d7e5ce7bc 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -1206,7 +1206,6 @@ void CodeGenFunction::EmitDoStmt(const DoStmt &S,
 
   uint64_t ParentCount = getCurrentProfileCount();
 
-
   // Emit the body of the loop.
   llvm::BasicBlock *LoopBody = createBasicBlock("do.body");
 
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index f93ec67b3..e339de866 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -1730,7 +1730,7 @@ StmtResult Parser::ParseWhileStatement(SourceLocation *TrailingElseLoc) {
   //
   unsigned ScopeFlags = 0;
   if (C99orCXX)
-    ScopeFlags = Scope::DeclScope  | Scope::ControlScope;
+    ScopeFlags = Scope::DeclScope | Scope::ControlScope;
 
   ParseScope WhileScope(this, ScopeFlags);
 

``````````

</details>


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


More information about the cfe-commits mailing list