[llvm-dev] Creating my own “clang-format” style that can be used across multiple projects with the “BasedOnStyle” setting

Timothy Wrona via llvm-dev llvm-dev at lists.llvm.org
Sun Dec 20 16:28:34 PST 2020


Hi,

This is my first time reaching out to the llvm mailing list so I apologize
if this is not the correct place to ask a question like this. (If it isn't
please let me know where I should post this question.)

I have multiple projects that I want to share a similar clang-format style,
but I also want to be able to make minor tweaks between each project so
they can be slightly different from one another if needed. Currently each
project just has the same .clang-format file copied and pasted into its own
repository, but it feels wrong because all of the style options are just
duplicated from project to project and if I need to change one option I
need to go across all projects and manually change it in all of them.

I would like to create my own style that can be used with the
"BasedOnStyle" option. That way I can specify that I want all of these
projects to be based on the same custom style that would be kept in a
shared location, and then I could easily override any project specific
options on a per-project basis.

I looked through the documentation and as far as I can tell, there doesn't
appear to be any way to create your own style and save it so other projects
can be based on the same style. I feel like this is something a lot of
users would need (for example if a company wanted to define their own
master style that all projects should follow).

Is there any way to do this? And if not, how could I go about requesting
such a feature be added?

Thanks,

Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201220/1dbb0814/attachment.html>


More information about the llvm-dev mailing list