-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed
Feature
Copy link
Labels
Description
Hello! I want to format my C++ code with custom formatting style specified in .clang-format file. The clang-format documentation says there is an option that allows to put short function bodies on the same line with functions.
https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowshortfunctionsonasingleline
However, this is not what I want. I want the function body braces to be put on the same line with function body itself, not the whole thing with signature.
With AllowShortFunctionsOnASingleLine: All:
inline const char* GetBuildingName(TTownType townType, type_building_id buildingId) { return FASTCALL_2(const char*, 0x460CC0, townType, buildingId); } // everything on the same line, uglyWith AllowShortFunctionsOnASingleLine: None:
inline const char* GetBuildingName(TTownType townType, type_building_id buildingId)
{
return FASTCALL_2(const char*, 0x460CC0, townType, buildingId); // I need it on the single line
}Desired behavior:
inline const char* GetBuildingName(TTownType townType, type_building_id buildingId)
{ return FASTCALL_2(const char*, 0x460CC0, townType, buildingId); } // what I want, but only for single-line body functionsIt would be also great to have such an option for structs/classes that contain only a single line of code inside their bodies. Thanks!