Typz added a comment.

In https://reviews.llvm.org/D50147#1244237, @krasimir wrote:

> I don't understand the use-case this patch is realizing. Suppose I have a 
> bunch of projects that have to share a format style. Then I can checkout them 
> under a common root directory and put an appropriate .clang-format file there.


You can do this manually, but this would not be in source-control and not 
"automatic" : you need to remember to copy the file in the root directory, and 
be sure to copy the correct one.
Also, this manual copy approach does not support updates very well.

We typically use large workspaces with many repositories (using git-repo), 
containing both open-source projects (hopefull with their own `.clang-format`, 
but more often not without any) and in-house projects.
Putting a .clang-format in the root directory would make it the default not 
only for our projects, but also for all OSS projects with no .clang-format, 
where it likely is not correct.
In addition, due to historical or regulatory reasons we unfortunately have 
multiple coding rules for the same language, in different projects : so we 
cannot just put at the root directory.

Allowing to implement "custom" styles outside of clang-format fixes this, by 
allowing to define this style globally; and then simpy reference the style in 
the project.
We can then also version the styles, e.g. create myStyle-1.0 and myStyle-1.1 to 
handle changes and let projects upgrade to the latest version as needed, and 
possibly create links to allow "tracking" the latest revision of a style (e.g. 
myStyle-latest is a symlink which points to myStyle-1.1).


Repository:
  rC Clang

https://reviews.llvm.org/D50147



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D50147: clang-fo... Krasimir Georgiev via Phabricator via cfe-commits
    • [PATCH] D50147: cla... Francois Ferrand via Phabricator via cfe-commits

Reply via email to