<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p><span itemprop="upvoteCount" class="vote-count-post "></span>Hi:<br>
</p>
<p><br>
</p>
<p>I do not like the BreakBeforeBraces in the default llvm style, I want to use GNU style. The final behavior of clang-format should be:</p>
<div>
<div class="post-text" itemprop="text">
<pre class="lang-cpp prettyprint prettyprinted" style=""><code><span class="lit">1.</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">.</span><span class="pln">clang</span><span class="pun">-</span><span class="pln">format exits in project directory</span><span class="pun">,</span><span class="pln"> use the style in </span><span class="pun">.</span><span class="pln">clang</span><span class="pun">-</span><span class="pln">format
</span><span class="lit">2.</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> no </span><span class="pun">.</span><span class="pln">clang</span><span class="pun">-</span><span class="pln">format exits</span><span class="pun">,</span><span class="pln"> use </span><span class="pun">-</span><span class="pln">style</span><span class="pun">={</span><span class="typ">BasedOnStyle</span><span class="pun">:</span><span class="pln"> LLVM</span><span class="pun">,</span><span class="pln"> </span><span class="typ">BreakBeforeBraces</span><span class="pun">:</span><span class="pln"> GNU</span><span class="pun">}</span></code></pre>
<p>from <a href="http://releases.llvm.org/4.0.0/tools/clang/docs/ClangFormat.html" rel="nofollow noreferrer" id="LPlnk747713">
http://releases.llvm.org/4.0.0/tools/clang/docs/ClangFormat.html</a>. I guess</p>
<pre class="lang-cpp prettyprint prettyprinted" style=""><code><span class="pln">clang</span><span class="pun">-</span><span class="pln">format </span><span class="pun">-</span><span class="pln">fallback</span><span class="pun">-</span><span class="pln">style</span><span class="pun">=</span><span class="str">'{BasedOnStyle: LLVM, BreakBeforeBraces: GNU}'</span></code></pre>
<p>should do the job, however, I get</p>
<pre class="lang-cpp prettyprint prettyprinted" style=""><code><span class="typ">Invalid</span><span class="pln"> fallback style </span><span class="str">"{BasedOnStyle: LLVM, BreakBeforeBraces: GNU}"</span><span class="pln"> </span><span class="kwd">using</span><span class="pln"> LLVM style</span></code></pre>
<p>I always use the clang-format via its vim plugin clang-format.py. If there is a method to do the job by modifying clang-format.py or .vimrc, it is also welcome.</p>
<p><br>
</p>
<p>Thank you<br>
</p>
</div>
</div>
<br>
<p></p>
</div>
</body>
</html>