[PATCH] D93938: [clang-format] Fixed AfterEnum handling
Ally Tiritoglu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 30 19:11:21 PST 2020
atirit updated this revision to Diff 314162.
atirit added a comment.
Changed commit username and email
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93938/new/
https://reviews.llvm.org/D93938
Files:
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -1344,8 +1344,7 @@
Style.AllowShortEnumsOnASingleLine = true;
verifyFormat("enum { A, B, C } ShortEnum1, ShortEnum2;", Style);
Style.AllowShortEnumsOnASingleLine = false;
- verifyFormat("enum\n"
- "{\n"
+ verifyFormat("enum {\n"
" A,\n"
" B,\n"
" C\n"
Index: clang/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1301,7 +1301,7 @@
if (!parseEnum())
break;
// This only applies for C++.
- if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) {
+ if (!Style.isCpp()) {
addUnwrappedLine();
return;
}
@@ -2484,6 +2484,9 @@
return true;
}
+ if (!Style.AllowShortEnumsOnASingleLine && Style.BraceWrapping.AfterEnum)
+ addUnwrappedLine();
+
// Parse enum body.
nextToken();
if (!Style.AllowShortEnumsOnASingleLine) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93938.314162.patch
Type: text/x-patch
Size: 1216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201231/5ba23af9/attachment.bin>
More information about the cfe-commits
mailing list