[cfe-dev] prevent clang-format from breaking string literals
Neumann, Adrian
adrian.neumann at siemens.com
Fri Apr 17 00:24:05 PDT 2015
Hi,
I would like to configure clang-format (version 3.6.0) not to break long
string literals despite the ColumnLimit. I tried setting PenaltyBreakString
to a large value and PenaltyExcessCharacter to a small value. This doesn't
seem to have any effect.
This is an example program:
#include <string>
int main() {
std::string s = "this is a really long string that"
"i really would like to have formatted differently, in
particular I want this line to stay like this";
}
clang-format --dump-config reports
ColumnLimit: 80
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 2000000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1
PenaltyReturnTypeOnItsOwnLine: 60
yet the program is formatted as such:
#include <string>
int main() {
std::string s = "this is a really long string that"
"i really would like to have formatted differently, in "
"particular I want this line to stay like this";
}
I there a way to solve this problem, or is this something clang can't do?
Greets,
Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 8804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150417/a0a0b5f7/attachment.bin>
More information about the cfe-dev
mailing list