Using clang-format - keep empty braces on the same line

I used combination of "AllowShortFunctionsOnASingleLine": true, and "BreakBeforeBraces": "Allman", to get it to one line when declaring empty constructors etc..


UPDATE: Hurray! It is now possible with Clang 5.0 or later with custom BreakBeforeBraces. See SplitEmptyFunction in the documentation.

Configuration example:

BreakBeforeBraces: Custom
BraceWrapping:
  SplitEmptyFunction: false

↓↓↓ Original answer (outdated) ↓↓↓

Unfortunately, it is not possible to achieve with Clang 4.0 the current clang-format options (as of Clang 4.0).

Source: I had the same question. After studying every documented option, and many tweaking attempts, I could not achieve this. In my experience, clang-format is just not as flexible as one would hope. As soon as you want to step out of the predefined styles and tweak things to your liking, it just does not cut it.