[PATCH] D135789: Add .editorconfig file

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


beanz added inline comments.


================
Comment at: .editorconfig:8
+charset = utf-8
+trim_trailing_whitespace = true
----------------
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.


================
Comment at: .editorconfig:9
+trim_trailing_whitespace = true
+
----------------
mgorny wrote:
> MaskRay wrote:
> > MaskRay wrote:
> > > beanz wrote:
> > > > mgorny wrote:
> > > > > Does it have some key not to add empty trailing lines? ;-)
> > > > The `insert_final_newline` adds that line, which is generally what we want because strict C states that all files should end with a newline. Both GCC and Clang have warnings for that.
> > > Remove the trailing blank line.
> > Do we need `end_of_line = lf`?
> > The `insert_final_newline` adds that line, which is generally what we want because strict C states that all files should end with a newline. Both GCC and Clang have warnings for that.
> 
> But there are *two* newlines at the end of the file now.
> Do we need `end_of_line = lf`?

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.


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