owenpan added a comment.

In D145435#4187575 <https://reviews.llvm.org/D145435#4187575>, @bersbersbers 
wrote:

> In D145435#4179662 <https://reviews.llvm.org/D145435#4179662>, @owenpan wrote:
>
>> Are the settings above hypothetical or are they real-world use cases?
>
> Real-world - actually, all of them.

Are they "used in a project of significant size (have dozens of contributors)"?

>> IMO, if people really want to have per-file configurations, they can do so 
>> outside of clang-format, e.g. using grep in a shell script.
>
> My main use case would be IDE integration - is there a way to achieve what 
> you propose from within Visual Studio, for example?

I don't use clang-format with Visual Studio, but one way is to have Visual 
Studio run your own script that greps the style from the comment and passes 
that to clang-format?

> The beauty of the current setup (I believe) is that clang-format is 
> pre-configured, so there is nothing to do except check out the code, and 
> formatting works out of the box.

The disadvantage is that it forces everyone else who needs to review or 
maintain the file to deal with a style that's different from that of the 
directory.

> In D145435#4183507 <https://reviews.llvm.org/D145435#4183507>, @owenpan wrote:
>
>> It would add extra runtime (especially for large files).
>
> That is a good point. It's probably an argument for restricting the search 
> for that comment to the first N lines of the file, in which case the 
> performance impact would be largely independent of file size. (I believe it 
> would even be beneficial for this comment to be required to be placed near 
> the top of the file, to reduce the amount of surprised users down the road.)

Are there other tools that require their special comments to be at the top of 
the file?

>> We would also run the risk of regressions (though unlikely) if for whatever 
>> reason an existing codebase has files starting with `// clang-format style=`.
>
> If that is any indication, that is not the case on GitHub at least:
> https://cs.github.com/?scopeName=All+repos&scope=&q=%22%2F%2F+clang-format+style%22

I said unlikely, but the risk is still there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145435

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to