[PATCH] D135789: Add .editorconfig file

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 12:52:06 PDT 2022


beanz added inline comments.


================
Comment at: .editorconfig:8
+charset = utf-8
+trim_trailing_whitespace = true
----------------
aaron.ballman wrote:
> beanz wrote:
> > aaron.ballman wrote:
> > > Do these settings apply to the whole file when it is saved, or only to the modifications in the file as they're being made?
> > > 
> > > I ask because of `trim_trailing_whitespace` specifically -- I have a text editor that does that automatically already when saving a file and I have to configure it to *not* do that because of how often it ends up making unrelated changes in a file when saving; especially our older test cases in Clang.
> > > Do these settings apply to the whole file when it is saved, or only to the modifications in the file as they're being made?
> > > 
> > > I ask because of `trim_trailing_whitespace` specifically -- I have a text editor that does that automatically already when saving a file and I have to configure it to *not* do that because of how often it ends up making unrelated changes in a file when saving; especially our older test cases in Clang.
> > 
> > That's a really good point. The documentation on https://editorconfig.org doesn't specify, so it might be editor dependent, but probably impacts the whole file.
> > That's a really good point. The documentation on https://editorconfig.org doesn't specify, so it might be editor dependent, but probably impacts the whole file.
> 
> If these impact the whole file, that's... troublesome for the trailing whitespace and the indentation fields because both of those will likely lead to unrelated edits in files. Perhaps we should see what supported editors do currently? If they all mostly agree and don't modify the whole file, maybe we can get away with it?
> 
> > We could. I think at some point I'd like to get LLVM & Clang building and passing tests with autocrlf enabled at which point that would become a potential problem.
> 
> Can we opt specific files out of autocrlf (Clang has a handful of test cases that are line ending sensitive)?
> Can we opt specific files out of autocrlf (Clang has a handful of test cases that are line ending sensitive)?

We can, and we already do in some cases. We have a couple `.gitattributes` files around the repo that specify specific line ending behaviors for certain files.

Clang has a lot of tests that are line ending sensitive, and my to-do list includes reviewing those to see which ones _should_ be line ending sensitive and if we can address them. Last year (or maybe it was earlier this year) I made a bunch of tests not line-ending sensitive by making column and file-offset values fuzzy-matched.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135789



More information about the llvm-commits mailing list