MyDeveloperDay added inline comments.
================ Comment at: clang/lib/Format/Format.cpp:1143 Style.PenaltyReturnTypeOnItsOwnLine = 1000; + Style.AllowEnumsOnASingleLine = false; Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None; ---------------- You'll need to fix up the C# tests ``` C:/llvm-project/clang/unittests/Format/FormatTestCSharp.cpp(48): error: Expected: Code.str() Which is: "public enum var { none, @string, bool, @enum }" To be equal to: format(Code, Style) Which is: "public enum var\n{\n none,\n @string,\n bool,\n @enum\n}" With diff: @@ -1,1 +1,7 @@ -public enum var { none, @string, bool, @enum } +public enum var +{ + none, + @string, + bool, + @enum +} ``` I think that is ok as most of the documentation seems to show them not on a single line https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/enum ================ Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1768 + if (!Style.AllowEnumsOnASingleLine) + addUnwrappedLine(); nextToken(); ---------------- see below, I think you need to know this braced Initialization is part of a enum ================ Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1829 + addUnwrappedLine(); break; default: ---------------- I'm wondering if this is going to impact other braced constructs? ``` void main() { std::vector<int> list = { 1,2,3}; } ``` becomes ``` void main() { std::vector<int> list = {1, 2, 3 }; } ``` ================ Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2295 + } bool HasError = !parseBracedList(/*ContinueOnSemicolons=*/true); + if (!Style.AllowEnumsOnASingleLine) ---------------- I think you are going to have to pass down that this BracedList is for a enum only CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78982/new/ https://reviews.llvm.org/D78982 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits