[llvm-bugs] [Bug 41159] New: clang-format over-indents with AlignAfterOpenBracket and AlignAfterOpenBracket=DontAlign
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 20 12:58:08 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41159
Bug ID: 41159
Summary: clang-format over-indents with AlignAfterOpenBracket
and AlignAfterOpenBracket=DontAlign
Product: clang
Version: 7.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: john.j.beard at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
Using the following code:
static LIB_TEXT* loadText( std::unique_ptr<LIB_PART>& aPart, LINE_READER&
aReader, int aMajorVersion );
static LIB_RECTANGLELIB_RECTANGLE* loadRectangle( std::unique_ptr<LIB_PART>&
aPart );
And this config:
BasedOnStyle: llvm
ContinuationIndentWidth: 8
AlignAfterOpenBracket: DontAlign
AlignConsecutiveDeclarations: true
Produces:
static LIB_TEXT * loadText( std::unique_ptr<LIB_PART> &aPart,
LINE_READER &aReader, int aMajorVersion );
static LIB_RECTANGLELIB_RECTANGLE *loadRectangle(
std::unique_ptr<LIB_PART> &aPart );
Where line 2 is indented by much more than the continuation indent.
Removing AlignConsecutiveDeclarations is OK:
static LIB_TEXT *loadText(std::unique_ptr<LIB_PART> &aPart,
LINE_READER &aReader, int aMajorVersion);
static LIB_RECTANGLELIB_RECTANGLE *loadRectangle(
std::unique_ptr<LIB_PART> &aPart);
And AlignAfterOpenBracket=Align is OK:
static LIB_TEXT *loadText(std::unique_ptr<LIB_PART> &aPart,
LINE_READER &aReader, int aMajorVersion);
static LIB_RECTANGLELIB_RECTANGLE *
loadRectangle(std::unique_ptr<LIB_PART> &aPart);
This seems like a similar case to https://bugs.llvm.org/show_bug.cgi?id=33546
where there are not enough spaces with AlignConsecutiveAssignments=true and
AlignAfterOpenBracket=Align
----
Easy one-line repro:
echo "static LIB_TEXT* loadText( std::unique_ptr<LIB_PART>& aPart, LINE_READER&
aReader, int aMajorVersion); static LIB_RECTANGLELIB_RECTANGLE* loadRectangle(
std::unique_ptr<LIB_PART>& aPart );" | clang-format -style="{BasedOnStyle:
llvm, ContinuationIndentWidth: 8, AlignAfterOpenBracket: DontAlign,
AlignConsecutiveDeclarations: true}"
--
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/20190320/1a888132/attachment.html>
More information about the llvm-bugs
mailing list