[cfe-dev] clang-format inconsistent behavior

Manuel Klimek via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 14 03:24:22 PST 2017


Not sure whether I'm unable to use my mail program correctly, but I don't
get a diff between desired.c and format_me.c.

Generally, we've thought about trying to make clang-format be more
consistent across subsequent statements, but
a) that's a lot of effort, as clang-format fundamentally works on each
statement separately
b) basically all instances (outside of braced lists, which have special
support) we've seen have been due to code duplication, where the right
answer is to refactor the code so the structure is simpler

For example, in your code, I would pull out a wrapper function that takes
all the common parameters in a struct, and potentially the other parameters
as structs, too. That way, the calls would become reasonably short.

On Mon, Feb 13, 2017 at 5:35 PM FIXED-TERM Kammel Fabian (ETAS-PSC/EPE) via
cfe-dev <cfe-dev at lists.llvm.org> wrote:

Hi All,



I have found an inconsistent behavior in clang-format. When I format the
attached desired.c with the attached .clang-format file (using Clang 4.0 on
Windows) I get format_me.c.



I think that the assignment should be consistent, either break the line for
all assignments or none of them. Is there an option I have missed or is
this behavior intended/not configurable? And if not configurable would we
be interested in such a switch?



Regards,

Fabian
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170214/eae39a36/attachment.html>


More information about the cfe-dev mailing list