https://llvm.org/bugs/show_bug.cgi?id=25132
Bug ID: 25132 Summary: BraceWrapping: AfterFunction flag interferes with formatting of empty class body Product: clang Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Formatter Assignee: unassignedclangb...@nondot.org Reporter: matti...@yahoo.co.uk CC: djas...@google.com, kli...@google.com, llvm-bugs@lists.llvm.org Classification: Unclassified $ clang-format -version clang-format version 3.8.0 (http://llvm.org/git/clang.git 47928a9602f4bc13c065bad2f7f940bee2711e63) (http://llvm.org/git/llvm.git 0425965d3ddad80c886b6795361c1902f7e1dd78) $ cat asdf.h class A {}; $ cat .clang-format --- BraceWrapping: AfterClass: true #AfterFunction: true BreakBeforeBraces: Custom ... $ clang-format --style=file asdf.h class A {}; Enable AfterFunction ==================== $ cat .clang-format --- BraceWrapping: AfterClass: true AfterFunction: true BreakBeforeBraces: Custom ... $ clang-format --style=file asdf.h class A { }; After recompilation (see below) =================== $ clang-format --style=file asdf.h class A {}; I suspect the following change may be incorrect for reasons I am unable to test... diff --git a/lib/Format/UnwrappedLineFormatter.cpp b/lib/Format/UnwrappedLineFormatter.cpp index 6d9b1da..67567be 100644 --- a/lib/Format/UnwrappedLineFormatter.cpp +++ b/lib/Format/UnwrappedLineFormatter.cpp @@ -199,7 +199,8 @@ private: return MergeShortFunctions ? tryMergeSimpleBlock(I, E, Limit) : 0; } if (TheLine->Last->is(tok::l_brace)) { - return !Style.BraceWrapping.AfterFunction + return !(TheLine->Last->is(TT_FunctionLBrace) && + Style.BraceWrapping.AfterFunction) ? tryMergeSimpleBlock(I, E, Limit) : 0; } -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs