[PATCH] D54881: [clang-format] Prevent Clang-Format from editing leading whitespace on lines outside of the format range

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 08:39:16 PDT 2019


klimek added a comment.

In D54881#1449848 <https://reviews.llvm.org/D54881#1449848>, @russellmcc wrote:

> klimek: I'm sorry, I don't fully understand your proposed fix.  Could you explain it in more detail?
>
> Without being able to respond to your proposal in detail, I strongly believe if you pass in a line range to clang-format, it should not change lines outside that range OR we should modify the documentation to clearly explain what the line filter option does.


That is a good point - generally, the problem is that one use case for clang-format is to give it some point in an expression, and have it fix that expression and currently "things around it that are off". I'm not saying that's the right solution, but if we want to change that it's a significant change to clang-format's workflow, so I think we'll need to carefully think about the effect this has, or provide reasons why we think this will not change those use cases.

For example, if I put {} around a range I typically use clang-format in some position in that range to fix up the whole range for me. This is a feature. I'm open to hearing more opinions, though.


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

https://reviews.llvm.org/D54881





More information about the cfe-commits mailing list