[clang] 7bc1031 - Revert "[clang-format] Fix align consecutive declarations over function pointers"
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 24 02:21:04 PDT 2023
Author: Owen Pan
Date: 2023-10-24T02:15:44-07:00
New Revision: 7bc1031c474ebb2216a5432273dafe4d1490fbce
URL: https://github.com/llvm/llvm-project/commit/7bc1031c474ebb2216a5432273dafe4d1490fbce
DIFF: https://github.com/llvm/llvm-project/commit/7bc1031c474ebb2216a5432273dafe4d1490fbce.diff
LOG: Revert "[clang-format] Fix align consecutive declarations over function pointers"
This reverts commit a84e0b4bdc9999872adbdaafbade8164b197784b.
Fixes #68079.
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 dc81060671c1712..dbe6175fb9653ed 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -980,7 +980,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 d5711782a23ef5b..02447dec840e367 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2033,8 +2033,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);
@@ -2080,8 +2078,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);
@@ -2107,8 +2103,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);
@@ -2149,8 +2143,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);
@@ -2176,8 +2168,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 cfe-commits
mailing list