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

            Bug ID: 38636
           Summary: [Formatter/ObjC] Break after return statement worsen
                    readability
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: joles...@google.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Current formatting (works fine when there is many elements):
return @{
  aaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
  aaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
};

Current formatting (works suboptimal when there is one element; lack of spaces
is a different bug: https://bugs.llvm.org/show_bug.cgi?id=36919):
return
    @{aaaaaaaaaaaaaaaaaaaa :
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa};

Should be (more readable and consistent with case when there is many elements):
return @{
    aaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
};

The same problem with array literals:
return
    @[ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
];

instead of:
return @[
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
];


Maybe it makes sense to increase the penalty for breaking after "return" as I
believe it may touch other constructions as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to