[clang] b3af2ef - [clang-format] Factor out loop variable. NFC.
Marek Kurdej via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 2 05:36:13 PST 2022
Author: Marek Kurdej
Date: 2022-02-02T14:36:00+01:00
New Revision: b3af2ef963b1c94ab40d940c5e2774a2ac9ec230
URL: https://github.com/llvm/llvm-project/commit/b3af2ef963b1c94ab40d940c5e2774a2ac9ec230
DIFF: https://github.com/llvm/llvm-project/commit/b3af2ef963b1c94ab40d940c5e2774a2ac9ec230.diff
LOG: [clang-format] Factor out loop variable. NFC.
* Break on the size of the used variable Content instead of Lines (even though both should have the same size).
Added:
Modified:
clang/lib/Format/BreakableToken.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp
index 417fada35119..78b23e952fab 100644
--- a/clang/lib/Format/BreakableToken.cpp
+++ b/clang/lib/Format/BreakableToken.cpp
@@ -410,13 +410,14 @@ BreakableBlockComment::BreakableBlockComment(
// now we just wrap them without stars.
Decoration = "";
}
- for (size_t i = 1, e = Lines.size(); i < e && !Decoration.empty(); ++i) {
+ for (size_t i = 1, e = Content.size(); i < e && !Decoration.empty(); ++i) {
+ const StringRef &Text = Content[i];
// If the last line is empty, the closing "*/" will have a star.
- if (i + 1 == e && Content[i].empty())
+ if (i + 1 == e && Text.empty())
break;
- if (!Content[i].empty() && i + 1 != e && Decoration.startswith(Content[i]))
+ if (!Text.empty() && i + 1 != e && Decoration.startswith(Text))
continue;
- while (!Content[i].startswith(Decoration))
+ while (!Text.startswith(Decoration))
Decoration = Decoration.drop_back(1);
}
More information about the cfe-commits
mailing list