[PATCH] D153585: [clang-format] Fix align consecutive declarations over function pointers
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 6 02:18:00 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa84e0b4bdc99: [clang-format] Fix align consecutive declarations over function pointers (authored by gedare, committed by owenpan).
Changed prior to commit:
https://reviews.llvm.org/D153585?vs=537359&id=537633#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153585/new/
https://reviews.llvm.org/D153585
Files:
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -2059,6 +2059,8 @@
"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);
@@ -2104,6 +2106,8 @@
"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);
@@ -2129,6 +2133,8 @@
"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);
@@ -2169,6 +2175,8 @@
"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);
@@ -2194,6 +2202,8 @@
"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);
Index: clang/lib/Format/WhitespaceManager.cpp
===================================================================
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -870,7 +870,7 @@
AlignTokens(
Style,
[](Change const &C) {
- if (C.Tok->is(TT_FunctionDeclarationName))
+ if (C.Tok->isOneOf(TT_FunctionDeclarationName, TT_FunctionTypeLParen))
return true;
if (C.Tok->isNot(TT_StartOfName))
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153585.537633.patch
Type: text/x-patch
Size: 2699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230706/1397e452/attachment.bin>
More information about the cfe-commits
mailing list