Clang-formal off brace wrapping

Viewed 166

I want to set my brace wrapping like this

Configuration::~Configuration()    
{
}

but when I set parameters

BraceWrapping:
  AfterClass:      false
  SplitEmptyFunction: false

it doen't work for me. Parameter "BreakBeforeBraces" set in Custom.

1 Answers

I think the parameter values should be reversed, this works for me.

AllowShortFunctionsOnASingleLine: None
BreakBeforeBraces: Custom
BraceWrapping:
  AfterClass: true  # This is optional
  AfterFunction: true
  SplitEmptyFunction: true

Because the place you want to break is after a function, but not a class, so we should have AfterFunction: true.

And you have to include the prototype so Clang could know it's a function.

Before:

class Configuration {
    public:
    ~Configuration();
};

Configuration::~Configuration() {}

After:

class Configuration
{
public:
  ~Configuration();
};

Configuration::~Configuration()
{
}
Related