[llvm-bugs] [Bug 24492] New: PointerAlignment not working when used together with BasedOnStyle: Google

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 18 12:22:33 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24492

            Bug ID: 24492
           Summary: PointerAlignment not working when used together with
                    BasedOnStyle: Google
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jasjuang at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

How to reproduce the bug:

test.h
---------------------------------
struct Err {
  explicit Err(const double* pt3d) : X_(pt3d[0]), Y_(pt3d[1]), Z_(pt3d[2]) {}

  double X_;
  double Y_;
  double Z_;
};


./clang-format -style="{BasedOnStyle: Google, PointerAlignment: Right}" test.h

output
---------------
struct Err {
  explicit Err(const double* pt3d) : X_(pt3d[0]), Y_(pt3d[1]), Z_(pt3d[2]) {}

  double X_;
  double Y_;
  double Z_;
};

However I am expecting
---------------
struct Err {
  explicit Err(const double *pt3d) : X_(pt3d[0]), Y_(pt3d[1]), Z_(pt3d[2]) {}

  double X_;
  double Y_;
  double Z_;
};

I also tested with
1. ./clang-format -style="{BasedOnStyle: llvm, PointerAlignment: Right}" test.h
2. ./clang-format -style="{BasedOnStyle: llvm, PointerAlignment: Left}" test.h
3. ./clang-format -style="{PointerAlignment: Right}" test.h

and these are all working properly, so it looks like a Google style specific
bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150818/9dbedc0d/attachment.html>


More information about the llvm-bugs mailing list