forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1666550 - Update
clang-tools
to clang-11
. r=dmajor
Differential Revision: https://phabricator.services.mozilla.com/D97137
- Loading branch information
1 parent
2744641
commit 9b60bc2
Showing
8 changed files
with
173 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
From b9e789447f14c0330edd22c82746af29e7c3b259 Mon Sep 17 00:00:00 2001 | ||
From: Sylvestre Ledru <[email protected]> | ||
Date: Sat, 17 Oct 2020 19:51:05 +0200 | ||
Subject: [PATCH] Revert "[clang-format] Fix AlignConsecutive on PP blocks" | ||
|
||
This reverts commit b2eb439317576ce718193763c12bff9fccdfc166. | ||
|
||
Caused the regression: | ||
https://bugs.llvm.org/show_bug.cgi?id=47589 | ||
|
||
Reviewed By: MyDeveloperDay | ||
|
||
Differential Revision: https://reviews.llvm.org/D89464 | ||
--- | ||
clang/lib/Format/FormatToken.h | 6 ----- | ||
clang/lib/Format/UnwrappedLineParser.cpp | 2 -- | ||
clang/lib/Format/WhitespaceManager.cpp | 10 +++----- | ||
clang/unittests/Format/FormatTest.cpp | 23 ------------------- | ||
clang/unittests/Format/FormatTestComments.cpp | 21 ----------------- | ||
5 files changed, 3 insertions(+), 59 deletions(-) | ||
|
||
diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h | ||
index d4287f53fde..b132a3e84da 100644 | ||
--- a/clang/lib/Format/FormatToken.h | ||
+++ b/clang/lib/Format/FormatToken.h | ||
@@ -183,12 +183,6 @@ struct FormatToken { | ||
/// before the token. | ||
bool MustBreakBefore = false; | ||
|
||
- /// Whether to not align across this token | ||
- /// | ||
- /// This happens for example when a preprocessor directive ended directly | ||
- /// before the token, but very rarely otherwise. | ||
- bool MustBreakAlignBefore = false; | ||
- | ||
/// The raw text of the token. | ||
/// | ||
/// Contains the raw token text without leading whitespace and without leading | ||
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp | ||
index a37386425aa..ea8a41cfba8 100644 | ||
--- a/clang/lib/Format/UnwrappedLineParser.cpp | ||
+++ b/clang/lib/Format/UnwrappedLineParser.cpp | ||
@@ -3037,7 +3037,6 @@ void UnwrappedLineParser::readToken(int LevelDifference) { | ||
} | ||
FormatTok = Tokens->getNextToken(); | ||
FormatTok->MustBreakBefore = true; | ||
- FormatTok->MustBreakAlignBefore = true; | ||
} | ||
|
||
if (!PPStack.empty() && (PPStack.back().Kind == PP_Unreachable) && | ||
@@ -3062,7 +3061,6 @@ void UnwrappedLineParser::pushToken(FormatToken *Tok) { | ||
Line->Tokens.push_back(UnwrappedLineNode(Tok)); | ||
if (MustBreakBeforeNextToken) { | ||
Line->Tokens.back().Tok->MustBreakBefore = true; | ||
- Line->Tokens.back().Tok->MustBreakAlignBefore = true; | ||
MustBreakBeforeNextToken = false; | ||
} | ||
} | ||
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp | ||
index 32e0b685ea0..3a265bd0916 100644 | ||
--- a/clang/lib/Format/WhitespaceManager.cpp | ||
+++ b/clang/lib/Format/WhitespaceManager.cpp | ||
@@ -411,11 +411,9 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches, | ||
if (Changes[i].NewlinesBefore != 0) { | ||
CommasBeforeMatch = 0; | ||
EndOfSequence = i; | ||
- // If there is a blank line, there is a forced-align-break (eg, | ||
- // preprocessor), or if the last line didn't contain any matching token, | ||
- // the sequence ends here. | ||
- if (Changes[i].NewlinesBefore > 1 || | ||
- Changes[i].Tok->MustBreakAlignBefore || !FoundMatchOnLine) | ||
+ // If there is a blank line, or if the last line didn't contain any | ||
+ // matching token, the sequence ends here. | ||
+ if (Changes[i].NewlinesBefore > 1 || !FoundMatchOnLine) | ||
AlignCurrentSequence(); | ||
|
||
FoundMatchOnLine = false; | ||
@@ -726,8 +724,6 @@ void WhitespaceManager::alignTrailingComments() { | ||
if (Changes[i].StartOfBlockComment) | ||
continue; | ||
Newlines += Changes[i].NewlinesBefore; | ||
- if (Changes[i].Tok->MustBreakAlignBefore) | ||
- BreakBeforeNext = true; | ||
if (!Changes[i].IsTrailingComment) | ||
continue; | ||
|
||
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp | ||
index 17d302f0b65..7e4d1fca509 100644 | ||
--- a/clang/unittests/Format/FormatTest.cpp | ||
+++ b/clang/unittests/Format/FormatTest.cpp | ||
@@ -11968,29 +11968,6 @@ TEST_F(FormatTest, AlignConsecutiveAssignments) { | ||
verifyFormat("int oneTwoThree = 123; // comment\n" | ||
"int oneTwo = 12; // comment", | ||
Alignment); | ||
- | ||
- // Bug 25167 | ||
- verifyFormat("#if A\n" | ||
- "#else\n" | ||
- "int aaaaaaaa = 12;\n" | ||
- "#endif\n" | ||
- "#if B\n" | ||
- "#else\n" | ||
- "int a = 12;\n" | ||
- "#endif\n", | ||
- Alignment); | ||
- verifyFormat("enum foo {\n" | ||
- "#if A\n" | ||
- "#else\n" | ||
- " aaaaaaaa = 12;\n" | ||
- "#endif\n" | ||
- "#if B\n" | ||
- "#else\n" | ||
- " a = 12;\n" | ||
- "#endif\n" | ||
- "};\n", | ||
- Alignment); | ||
- | ||
EXPECT_EQ("int a = 5;\n" | ||
"\n" | ||
"int oneTwoThree = 123;", | ||
diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp | ||
index 47509f29744..d5b9f8e0885 100644 | ||
--- a/clang/unittests/Format/FormatTestComments.cpp | ||
+++ b/clang/unittests/Format/FormatTestComments.cpp | ||
@@ -2780,27 +2780,6 @@ TEST_F(FormatTestComments, AlignTrailingComments) { | ||
" // line 2 about b\n" | ||
" long b;", | ||
getLLVMStyleWithColumns(80))); | ||
- | ||
- // Checks an edge case in preprocessor handling. | ||
- // These comments should *not* be aligned | ||
- EXPECT_EQ( | ||
- "#if FOO\n" | ||
- "#else\n" | ||
- "long a; // Line about a\n" | ||
- "#endif\n" | ||
- "#if BAR\n" | ||
- "#else\n" | ||
- "long b_long_name; // Line about b\n" | ||
- "#endif\n", | ||
- format("#if FOO\n" | ||
- "#else\n" | ||
- "long a; // Line about a\n" // Previous (bad) behavior | ||
- "#endif\n" | ||
- "#if BAR\n" | ||
- "#else\n" | ||
- "long b_long_name; // Line about b\n" | ||
- "#endif\n", | ||
- getLLVMStyleWithColumns(80))); | ||
} | ||
|
||
TEST_F(FormatTestComments, AlignsBlockCommentDecorations) { | ||
-- | ||
2.28.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.