krasimir requested changes to this revision.
krasimir added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/Format/BreakableToken.cpp:327
+ TokenText.substr(2, TokenText.size() - 4)
+ .split(Lines, TokenText.count('\r') > 0 ? "\r\n" : "\n");
----------------
alexfh wrote:
> FYI, there's a global UseCRLF flag in WhitespaceManager. It may make sense to
> use it everywhere instead of deciding for each comment. But I'll let actual
> clang-format maintainers decide on pros and cons of this.
In case the text contains both `\r\n`-s and `\n` not preceded by `\r`, this
would not break on the `\n`; neither will a version using
`WhitespaceManager::UsesCRLF`. That is computed by:
```
bool inputUsesCRLF(StringRef Text) {
return Text.count('\r') * 2 > Text.count('\n');
}```
which implies that we at least tentatively support such mixed cases.
I'd try keeping the split here just by `"\n"` and stripping a trailing
`"\r"`from each line as a second step.
Repository:
rC Clang
https://reviews.llvm.org/D47577
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits