<div dir="ltr">Adding Beren, who has done the development here.<br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 13, 2015 at 12:01 AM, Graham St Jack via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="cremed">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I am looking at using clang-format, and like everyone else with a pre-existing quirky style, there are some things that clang-format doesn't seem to handle for me.<br>
<br>
Most of the issues are minor - we can just redefine our style, or they occur rarely enough for it not to matter.<br>
<br>
Some things that stand out as odd though (and make adoption difficult) are the following blocks of code formatted with this .clang-format file, using clang-format-3.8 built from trunk source yesterday.<br>
<br>
BasedOnStyle: LLVM<br>
<br>
AlignConsecutiveAssignments: true<br>
AlignConsecutiveDeclarations: true<br>
AllowShortCaseLabelsOnASingleLine: true<br>
AllowShortFunctionsOnASingleLine: Inline<br>
BinPackParameters: false<br>
BinPackArguments: false<br>
BraceWrapping:<br>
IndentBraces: false<br>
AfterNamespace: false<br>
AfterClass: true<br>
AfterControlStatement: true<br>
AfterEnum: true<br>
AfterFunction: true<br>
AfterStruct: true<br>
AfterUnion: true<br>
BeforeCatch: true<br>
BeforeElse: true<br>
BreakBeforeBraces: Custom<br>
ConstructorInitializerIndentWidth: 2<br>
ContinuationIndentWidth: 2<br>
ConstructorInitializerAllOnOneLineOrOnePerLine: true<br>
MaxEmptyLinesToKeep: 1<br>
<br>
----------------------------------------<br>
<br>
int * err = 0;<br>
ino_t_xx dir_inode = 0;<br>
gen_t dir_gen = 0;<br>
<br>
Here, the variables and equal-signs are lined up beautifully, but the star isn't hard up against 'err' - which I would have expected given the fact that LLVM sets PointerAlignment to Right. Looking into the implementation (and doing some experiments), it looks like 'Right' just means "no need to put a space to the right of a star" - but plenty of spaces can be inserted to align the variable. Is this intentional, and if so, is there a plan to add a new option to align pointers/references to the right (as distinct from not-left like now)?<br>
<br>
Since (regrettably) in C/C++, "pointerness" is associated with the variable and not the type, having the star hard up against the variable seems to me to be something that a lot of people would want.<br>
<br>
<br>
----------------------------------------<br>
<br>
static int find_highest_index(ino_t base_inode,<br>
gen_t base_gen,<br>
int fd,<br>
uint32_t *highest_index)<br>
<br>
This looks like a bug - if it aligns some of the parameters, it should align all of them.<br>
<br>
----------------------------------------<br>
<br>
static int find_highest_index(<br>
ino_t base_inode, gen_t base_gen, int fd, uint32_t *highest_index, bool dummy)<br>
<br>
This looks like a bug too - I added an extra parameter with a short type to demonstrate that the first and last parameters aren't aligned, but it put them all on one line. If there is an extra configuration parameter that would prevent this, please let me know.<br>
<br>
----------------------------------------<br>
<br>
static int find_highest_index(ino_t base_inode,<br>
int fd,<br>
uint32_t *highest_index,<br>
bool dummy)<br>
<br>
Here is the example that shows the first and last parameter aren't aligned, but the others are.<br>
<br>
<br>
Thanks<span><font color="#888888"><br>
<br>
-- <br>
Graham St Jack | Software Engineer | Quantum<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="cremed">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank" class="cremed">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</font></span></blockquote></div><br></div></div>