[PATCH] D19031: clang-format: Flexible line endings
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 14 07:58:06 PST 2019
MyDeveloperDay added a comment.
Sorry I'm reviewing very old revisions, @mxbOctasic are you still interested in a patch like this?
> It's not clang-format's task to clean up files with mixed line endings
This is an interesting thought given that clang-format does exactly that based on how many ^M's there are in the file
if I make a file:
// A^M
// B^M
// C
// D
and have vim auto format on save when I come back it says
// A^M
// B^M
// C^M
// D
according to notepad++ its
F10738809: image.png <https://reviews.llvm.org/F10738809>
but if I take this file and clang-format test.cpp > out.cpp I get
F10738811: image.png <https://reviews.llvm.org/F10738811>
So I'm fine if the rule is it isn't "clang-format" job to adjust line endings... but if that's the case it should leave them alone, I think the 50/50 rule is a little crude at best!
I think it would be nice if clang-format could be setup to be "specific" and not random based on how large a section someone editing in a file in Visual studio without the correct setting.
For me, not having to remember to do a separate `dos2unix` would really help reduce the number of "Fix line endings" commits we see (especially on platforms where dos2unix isn't available in the shell)
This could really have helped the 1/2 million commits on github...(https://github.com/search?q=%22line+endings%22&type=Commits)
I think this patch like this is a good compromise, I'd personally just make `UseCRLF` and enum, I don't think it needs 2 options
enum {
Derived // |Do as we do now
LF // like doing a dos2unix
CRLF // like doing a unix2dos
}
Stil interested?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D19031/new/
https://reviews.llvm.org/D19031
More information about the cfe-commits
mailing list