[PATCH] D50147: clang-format: support external styles

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 29 10:29:50 PDT 2018


sammccall added a comment.

In https://reviews.llvm.org/D50147#1279056, @Typz wrote:

> In https://reviews.llvm.org/D50147#1272742, @sammccall wrote:
>
> > The idea here does seem to be a natural extension of -style, at least for the case when the arg is a filename directly. I'm not opposed, happy to review this.
> >
> > I do want to probe the use case a bit though: we have found that configuring via -style= doesn't scale that well to lots of codebases and tools. e.g. if someone's running clang-tidy or clangd via some driver, are they going to have a way to plumb through the right -style=?
> >
> > Being able to discover the right style from the filesystem is powerful, and if I was going to use this flag, I'd consider symlinking the style-file to `subproject/.clang_format` instead. That way the setting is persistent and available to all tools, rather than us needing to get it right on each invocation.
>
>
> I totally agree: using '-style' does not scale well. However this patch works also when the style is used in the 'basedOn' tag. This is actually the way we expect to use this: store a small .clang_format file in each repo, which simply references a clang-format file which must be installed (manually, for now) on each user's computer.


`BasedOn: "/path/to/some/file"` would certainly work; but why not just use a symlink?


Repository:
  rC Clang

https://reviews.llvm.org/D50147





More information about the cfe-commits mailing list