atirit created this revision. atirit requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D93938 Files: clang/lib/Format/UnwrappedLineParser.cpp Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -694,6 +694,8 @@ return Style.BraceWrapping.AfterUnion; if (InitialToken.is(tok::kw_struct)) return Style.BraceWrapping.AfterStruct; + if (InitialToken.is(tok::kw_enum)) + return Style.BraceWrapping.AfterEnum; return false; } @@ -1299,7 +1301,7 @@ if (!parseEnum()) break; // This only applies for C++. - if (!Style.isCpp()) { + if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) { addUnwrappedLine(); return; } @@ -2482,8 +2484,6 @@ return true; } - if (!Style.AllowShortEnumsOnASingleLine) - addUnwrappedLine(); // Parse enum body. nextToken(); if (!Style.AllowShortEnumsOnASingleLine) {
Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -694,6 +694,8 @@ return Style.BraceWrapping.AfterUnion; if (InitialToken.is(tok::kw_struct)) return Style.BraceWrapping.AfterStruct; + if (InitialToken.is(tok::kw_enum)) + return Style.BraceWrapping.AfterEnum; return false; } @@ -1299,7 +1301,7 @@ if (!parseEnum()) break; // This only applies for C++. - if (!Style.isCpp()) { + if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) { addUnwrappedLine(); return; } @@ -2482,8 +2484,6 @@ return true; } - if (!Style.AllowShortEnumsOnASingleLine) - addUnwrappedLine(); // Parse enum body. nextToken(); if (!Style.AllowShortEnumsOnASingleLine) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits