[PATCH] D127366: [clang-format][NFC] Format lib/Format and unittests/Format in clang
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 9 02:26:37 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG40a5d79a5cb4: [clang-format][NFC] Format lib/Format and unittests/Format in clang (authored by owenpan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127366/new/
https://reviews.llvm.org/D127366
Files:
clang/lib/Format/BreakableToken.cpp
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -25439,8 +25439,7 @@
verifyFormat("do {\n"
" ++I;\n"
"} while (hasMore() && Filter(*I));",
- "do { ++I; } while (hasMore() && Filter(*I));",
- Style);
+ "do { ++I; } while (hasMore() && Filter(*I));", Style);
verifyFormat("if (a)\n"
" if (b)\n"
Index: clang/lib/Format/WhitespaceManager.cpp
===================================================================
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -230,12 +230,10 @@
if (Change.Tok->is(tok::comment)) {
if (Change.Tok->is(TT_LineComment) || !Change.IsInsideToken) {
LastBlockComment = &Change;
- } else {
- if ((Change.StartOfBlockComment = LastBlockComment)) {
- Change.IndentationOffset =
- Change.StartOfTokenColumn -
- Change.StartOfBlockComment->StartOfTokenColumn;
- }
+ } else if ((Change.StartOfBlockComment = LastBlockComment)) {
+ Change.IndentationOffset =
+ Change.StartOfTokenColumn -
+ Change.StartOfBlockComment->StartOfTokenColumn;
}
} else {
LastBlockComment = nullptr;
Index: clang/lib/Format/BreakableToken.cpp
===================================================================
--- clang/lib/Format/BreakableToken.cpp
+++ clang/lib/Format/BreakableToken.cpp
@@ -705,11 +705,9 @@
// contain a trailing whitespace.
Prefix = Prefix.substr(0, 1);
}
- } else {
- if (ContentColumn[LineIndex] == 1) {
- // This line starts immediately after the decorating *.
- Prefix = Prefix.substr(0, 1);
- }
+ } else if (ContentColumn[LineIndex] == 1) {
+ // This line starts immediately after the decorating *.
+ Prefix = Prefix.substr(0, 1);
}
// This is the offset of the end of the last line relative to the start of the
// token text in the token.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127366.435462.patch
Type: text/x-patch
Size: 2134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220609/2cdbd84b/attachment.bin>
More information about the cfe-commits
mailing list