[clang] 179ade6 - [clang-format] Fix an issue reported by static analyzer
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 27 21:21:09 PST 2024
Author: Owen Pan
Date: 2024-01-27T21:21:01-08:00
New Revision: 179ade6a6d78533179205640dd161bf179daa9ee
URL: https://github.com/llvm/llvm-project/commit/179ade6a6d78533179205640dd161bf179daa9ee
DIFF: https://github.com/llvm/llvm-project/commit/179ade6a6d78533179205640dd161bf179daa9ee.diff
LOG: [clang-format] Fix an issue reported by static analyzer
Fixes #79685.
Added:
Modified:
clang/lib/Format/WhitespaceManager.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index df84f97a8e8ac1..f9eed7f516bbeb 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -1469,7 +1469,7 @@ WhitespaceManager::CellDescriptions WhitespaceManager::getCells(unsigned Start,
while (NextNonComment->is(tok::comma))
NextNonComment = NextNonComment->getNextNonComment();
auto j = i;
- while (Changes[j].Tok != NextNonComment && j < End)
+ while (j < End && Changes[j].Tok != NextNonComment)
++j;
if (j < End && Changes[j].NewlinesBefore == 0 &&
Changes[j].Tok->isNot(tok::r_brace)) {
More information about the cfe-commits
mailing list