[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 25 13:53:03 PDT 2024


ldrumm wrote:

> I don't have a strong opinion, but fundamentally I would prefer if the source control system stored exactly the files I have in my checkout, not mess with them in any way. I understand there are practical concerns, but a linter for unexpected CRLF would maybe be an option?

That wish is fine until you start working with others. Then you get 50000 line diffs that are somebody changing a single line on *their* system, because they happen to use the opposite system to the last person to check code in.  I think the best middle ground here is to say `-text` or `eol=input` for files that *must* be encoded a certain way.

As for linters: linters require people to run it, and we still have to encode those rules somewhere - just not gitattributes. As far as I can see this is the lowest overhead and most reliable *pragmatic* option that has the nice property of being fully integrated into the tooling, transparent to end users, and in a known (semi) central location.


https://github.com/llvm/llvm-project/pull/86318


More information about the cfe-commits mailing list