Clang-Format, tok::string_literal around tok::lessless introduces a newline

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Clang-Format, tok::string_literal around tok::lessless introduces a newline

suyash singh via cfe-dev
Hey,

At my current project we are working to integrate clang format into our daily routine and would like to apply it to our legacy code. We noticed in a trial run that the following piece of code, formats in a rather weird way (anonymized):

QStringList << "something" << "something" << variable;

It adds a '\n' after the first "something", which apparently is intented, according to the code in TokenAnnotator.cpp (line 3073, introduced in commit df28f7b8dd6a032515109de4ff5b4067be95da8e, git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225444 91177308-0d34-0410-b5e6-96231b3b80d8).

The question is, is this a bug, introduced by splitting off std::endl; into mutiple lines, or is this intended? I didn't want to create a bug for it, as the code seems to be very clear about it.

Of course we can rewrite the given code to an initializer list, and are likely going to do this for all new code anyway.

Kind regards,
Jeffrey van de Glind
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev