[llvm-branch-commits] [clang] fb62a20 - Revert "[clang-format] Fix align consecutive declarations over function pointers"
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Oct 27 05:51:11 PDT 2023
Author: Owen Pan
Date: 2023-10-27T14:47:59+02:00
New Revision: fb62a201a199663dcaf6511bd7a453ff669438e4
URL: https://github.com/llvm/llvm-project/commit/fb62a201a199663dcaf6511bd7a453ff669438e4
DIFF: https://github.com/llvm/llvm-project/commit/fb62a201a199663dcaf6511bd7a453ff669438e4.diff
LOG: Revert "[clang-format] Fix align consecutive declarations over function pointers"
This reverts commit a84e0b4bdc9999872adbdaafbade8164b197784b.
Fixes #68079.
(cherry picked from commit 7bc1031c474ebb2216a5432273dafe4d1490fbce)
Added:
Modified:
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index 668ca38ad68362e..c1016c44a74a70e 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -965,7 +965,7 @@ void WhitespaceManager::alignConsecutiveDeclarations() {
AlignTokens(
Style,
[](Change const &C) {
- if (C.Tok->isOneOf(TT_FunctionDeclarationName, TT_FunctionTypeLParen))
+ if (C.Tok->is(TT_FunctionDeclarationName))
return true;
if (C.Tok->isNot(TT_StartOfName))
return false;
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 2648940c3c393f5..dc867ab13172f1b 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2059,8 +2059,6 @@ TEST_F(FormatTest, SeparatePointerReferenceAlignment) {
"const unsigned int *d;\n"
"Const unsigned int &e;\n"
"const unsigned int &f;\n"
- "int *f1(int *a, int &b, int &&c);\n"
- "double *(*f2)(int *a, double &&b);\n"
"const unsigned &&g;\n"
"Const unsigned h;",
Style);
@@ -2106,8 +2104,6 @@ TEST_F(FormatTest, SeparatePointerReferenceAlignment) {
"const unsigned int* d;\n"
"Const unsigned int& e;\n"
"const unsigned int& f;\n"
- "int* f1(int* a, int& b, int&& c);\n"
- "double* (*f2)(int* a, double&& b);\n"
"const unsigned&& g;\n"
"Const unsigned h;",
Style);
@@ -2133,8 +2129,6 @@ TEST_F(FormatTest, SeparatePointerReferenceAlignment) {
"const unsigned int *d;\n"
"Const unsigned int& e;\n"
"const unsigned int& f;\n"
- "int *f1(int *a, int& b, int&& c);\n"
- "double *(*f2)(int *a, double&& b);\n"
"const unsigned g;\n"
"Const unsigned h;",
Style);
@@ -2175,8 +2169,6 @@ TEST_F(FormatTest, SeparatePointerReferenceAlignment) {
"const unsigned int* d;\n"
"Const unsigned int & e;\n"
"const unsigned int & f;\n"
- "int* f1(int* a, int & b, int && c);\n"
- "double* (*f2)(int* a, double && b);\n"
"const unsigned && g;\n"
"Const unsigned h;",
Style);
@@ -2202,8 +2194,6 @@ TEST_F(FormatTest, SeparatePointerReferenceAlignment) {
"const unsigned int * d;\n"
"Const unsigned int &e;\n"
"const unsigned int &f;\n"
- "int * f1(int * a, int &b, int &&c);\n"
- "double * (*f2)(int * a, double &&b);\n"
"const unsigned &&g;\n"
"Const unsigned h;",
Style);
More information about the llvm-branch-commits
mailing list