[clang] 8e16365 - Revert "[clang-format] Fix indentation for selective formatting"
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Tue May 23 22:18:22 PDT 2023
Author: Owen Pan
Date: 2023-05-23T22:18:13-07:00
New Revision: 8e16365cb6162a29a2a8d26f2d5f0081a651d73a
URL: https://github.com/llvm/llvm-project/commit/8e16365cb6162a29a2a8d26f2d5f0081a651d73a
DIFF: https://github.com/llvm/llvm-project/commit/8e16365cb6162a29a2a8d26f2d5f0081a651d73a.diff
LOG: Revert "[clang-format] Fix indentation for selective formatting"
This reverts commit 72ab89e3197cc1bee3b9774edb504690e3e43ed0.
Reverted due to bots failures e.g.
https://lab.llvm.org/buildbot/#/builders/139/builds/41339.
Added:
Modified:
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/unittests/Format/FormatTestSelective.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 0a2a4391d21c8..33be74dfe1b9f 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -74,12 +74,6 @@ class LevelIndentTracker {
: Line.Level * PPIndentWidth;
Indent += AdditionalIndent;
} else {
- // When going to lower levels, forget previous higher levels so that we
- // recompute future higher levels. But don't forget them if we enter a PP
- // directive, since these do not terminate a code block.
- if (!Line.InPPDirective)
- IndentForLevel.resize(Line.Level + 1);
-
Indent = getIndent(Line.Level);
}
if (static_cast<int>(Indent) + Offset >= 0)
@@ -916,7 +910,6 @@ class LineJoiner {
Tok->TotalLength += LengthA;
A.Last = Tok;
}
- A.Level = B.Level;
}
const FormatStyle &Style;
diff --git a/clang/unittests/Format/FormatTestSelective.cpp b/clang/unittests/Format/FormatTestSelective.cpp
index 96e42dd3a2d18..86ed7aba1913d 100644
--- a/clang/unittests/Format/FormatTestSelective.cpp
+++ b/clang/unittests/Format/FormatTestSelective.cpp
@@ -528,26 +528,6 @@ TEST_F(FormatTestSelective, ReformatRegionAdjustsIndent) {
format(" int a;\n"
"void ffffff() {}",
11, 0));
-
- // https://github.com/llvm/llvm-project/issues/59178
- Style = getMozillaStyle();
- EXPECT_EQ("int a()\n"
- "{\n"
- "return 0;\n"
- "}\n"
- "int b()\n"
- "{\n"
- " return 42;\n"
- "}",
- format("int a()\n"
- "{\n"
- "return 0;\n"
- "}\n"
- "int b()\n"
- "{\n"
- "return 42;\n" // Format this line only
- "}",
- 32, 0));
}
TEST_F(FormatTestSelective, UnderstandsTabs) {
More information about the cfe-commits
mailing list