Reputation: 194
I have this function:
bool WS::receive(MB *const buffer) const {
updateLastPackage();
if ((!lastPackage_.empty()) &&
(lastPackage_.size() <= buffer->capacity()) &&
(lastUpdate_.getTime() <= settings_.refreshPeriod)) {
buffer->clear();
(*buffer) << lastPackage_;
return true;
}
return false;
}
After apply clang-format with my style file:
bool WS::receive(MB *const buffer) const {
updateLastPackage();
if ((!lastPackage_.empty()) &&
(lastPackage_.size() <= buffer->capacity()) &&
(lastUpdate_.getTime() <= settings_.refreshPeriod)) {
buffer->clear();
(*buffer) << lastPackage_;
return true;
}
return false;
}
You can see that clang-format removes indents in if condition when there is a line break. So, how to keep indents unchanged? This also happened with templates.
My style file, based on LLVM: https://pastebin.com/ZDwZfBud
Upvotes: 1
Views: 1114
Reputation: 194
Thanks goes to Yksisarvinen.
Solution:
AlignOperands: false
ContinuationIndentWidth: 8
Upvotes: 1