[cfe-dev] Clang-format configuration files
Alexander Kornienko
alexfh at google.com
Mon May 6 11:54:06 PDT 2013
It's time for clang-format to support more flexible style configuration.
We're starting to work on configuration files support for clang-format.
Some thoughts on desired features and overall design:
- *contents*: fields of the FormatStyle struct, which currently has < 20
fields of primitive types;
- *format*: a set of key-value pairs, most probably JSON or YAML with
flat structure, e.g.:
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
...
- *file location*: in a longer term we'd like to support local
per-project hierarchical model, so that style can be configured for a
project and then partially or fully overridden in its various subprojects.
E.g. for this directory structure:
dir:
.clang-format
a.cpp
subdir:
.clang-format
b.cpp
*clang-format dir/a.cpp* should read only dir/.clang-format (assuming
that there are no .clang-format files in parent directories), *clang-format
dir/subdir/b.cpp* should use configuration values from
dir/subdir/.clang-format, and for the values not defined there try to
get them from dir/.clang-format
- *command-line interface*: there's currently -style option which takes
a name of a predefined style, we can use "-style config" or "-style file"
to turn on configuration file parsing, or turn it on by default.
Any comments/suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130506/b62e16b1/attachment.html>
More information about the cfe-dev
mailing list