if Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_All, clang-format tries to join short functions and prints in single line.
This code was not taking care of cases where there is something in between function header and body e.g. attached test cases where
there are preprocessor directives in between function header and body.
Attached patch fixes this issue by checking if we have both header and body and nothing between them while trying to merge functions.
Please let me know if this is ok.
How about moving the MustBreakBefore check to line 535, i.e.:
I think it is trivially correct and much easier to see that I[1] is guaranteed to exist.