<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 6, 2013 at 12:54 PM, Alexander Kornienko <span dir="ltr"><<a href="mailto:alexfh@google.com" target="_blank">alexfh@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">It's time for clang-format to support more flexible style configuration. We're starting to work on configuration files support for clang-format.<div>
<br><div>Some thoughts on desired features and overall design:<div>
<ul><li><b>contents</b>: fields of the FormatStyle struct, which currently has < 20 fields of primitive types;</li>
<li><b>format</b>: a set of key-value pairs, most probably JSON or YAML with flat structure, e.g.:<br> ColumnLimit: 80<br> ConstructorInitializerAllOnOneLineOrOnePerLine: true<br> ...</li><li><b>file location</b>: 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:<br>
<font face="courier new, monospace"> dir:<br> .clang-format<br> a.cpp<br> subdir:<br> .clang-format<br> b.cpp<br></font><br><font face="courier new, monospace"><b>clang-format dir/a.cpp</b></font> should read only <font face="courier new, monospace">dir/.clang-format</font> (assuming that there are no .clang-format files in parent directories), <font face="courier new, monospace"><b>clang-format dir/subdir/b.cpp</b></font> should use configuration values from <font face="courier new, monospace">dir/subdir/.clang-format</font>, and for the values not defined there try to get them from <font face="courier new, monospace">dir/.clang-format</font></li>
<li><font face="arial, helvetica, sans-serif"><b>command-line interface</b>: there's currently </font><font face="courier new, monospace">-style</font><font face="arial, helvetica, sans-serif"> option which takes a name of a predefined style, we can use "</font><font face="courier new, monospace">-style config</font><font face="arial, helvetica, sans-serif">" or "</font><font face="courier new, monospace">-style file</font><font face="arial, helvetica, sans-serif">" to turn on configuration file parsing, or turn it on by default.</font></li>
</ul><font face="arial, helvetica, sans-serif">Any comments/suggestions?</font></div></div></div></div>
<br></blockquote><div><br></div><div style>In case you weren't aware of it, we have a great YAML library <a href="http://llvm.org/docs/YamlIO.html">http://llvm.org/docs/YamlIO.html</a> which you should use if you go the YAML route (or JSON, which is a subset of YAML).</div>
<div style><br></div><div style>-- Sean Silva </div></div></div></div>