[PATCH] D19031: [clang-format] Flexible line endings

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 15 00:48:40 PST 2019


MyDeveloperDay added a comment.

In D19031#1746705 <https://reviews.llvm.org/D19031#1746705>, @STL_MSFT wrote:

> MSVC's STL currently uses CRLF (DOS) line endings, not LF (Unix). I wrote a validator, https://github.com/microsoft/STL/blob/58bb49d63d92e7a0346a05af29816aeea6b4cf0f/tools/validate/validate.cpp , to detect LF files, mixed line endings (LF and CRLF in the same file), damaged endings (CR only), and enforcing one newline at the end of every file, because clang-format doesn't currently handle those whitespace issues.


@STL_MSFT I saw your tweet on the matter, I'd like to bring some of these rules into clang-format I think this patch might help, because it would be able to setup CRLF endings in the same way others would setup LF,

I also agree about the EOF, this can be a major pain as not all compilers complain and if you are doing cross-platform work developers accidentally forgetting them can cause a reasonable number of housekeeping post commits  https://github.com/search?p=2&q=%22EOF%22&type=Commits

I like the idea of being able to turn off the derived rule, and using specific CRLF or LF rule to ensure conformance, (even if I'm just using clang-format to identify the issues in a pre merge check. i.e. having my .clang-format on my CI system being a little stricter)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D19031/new/

https://reviews.llvm.org/D19031





More information about the cfe-commits mailing list