[PATCH] D152473: [clang-format] Add test case for issue 63170
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 13 05:27:59 PDT 2023
MyDeveloperDay added a comment.
Part of my concern was that the reversion removed a unit test, which effectively regressed a different fix, I'm not comfortable with that.
I think we can resolve the original problem with the following fix.
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 33be74dfe1b9..4876d8cdcf0c 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1489,6 +1489,7 @@ void UnwrappedLineFormatter::formatFirstToken(
// Insert or remove empty line after access specifiers.
if (PreviousLine && PreviousLine->First->isAccessSpecifier() &&
+ !RootToken.Finalized &&
(!PreviousLine->InPPDirective || !RootToken.HasUnescapedNewline)) {
// EmptyLineBeforeAccessModifier is handling the case when two access
// modifiers follow each other.
================
Comment at: clang/unittests/Format/FormatTest.cpp:12859
Style);
- verifyFormat("struct foo {\n"
- "#ifdef FOO\n"
----------------
removing a test, only hides another regression, this should have been left really, and a fix worked.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152473/new/
https://reviews.llvm.org/D152473
More information about the cfe-commits
mailing list