<div dir="ltr">Sorry for the late answer, the mail was lost in my inbox.<br><div class="gmail_extra"><br></div><div class="gmail_extra">You're totally right about the pointer and reference attachment rules, but currently the alignment code doesn't really handle it. I don't think it would be very hard to implement, but I am wondering what the expected alignment would be in the case of nested pointer / cv qualifiers. I personally find such cases troublesome, and that is why I usually attach the pointers and qualifiers to the type and not to the variable.<br><br>For example, where should the spaces be inserted in the following case:<br><span style="font-family:monospace,monospace"><br></span></div><div class="gmail_extra"><span style="font-family:monospace,monospace">const char* const* v1;<br></span></div><div class="gmail_extra"><span style="font-family:monospace,monospace">float const* v2;</span></div><div class="gmail_extra"><span style="font-family:monospace,monospace">SomeVeryLongType const& v3;</span><br><br></div><div class="gmail_extra">Regarding the function parameter misalignment, this is certainly a bug and you can file a bugreport about it if you like. I will try to reproduce and fix it anyway.<br><br>Thanks,<br clear="all"></div><div class="gmail_extra"><div><div class="gmail_signature">--<br>Beren Minor</div></div>
<br><div class="gmail_quote">On Fri, Nov 13, 2015 at 9:52 AM, Daniel Jasper <span dir="ltr"><<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Adding Beren, who has done the development here.<div><div class="h5"><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">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</font></span></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>