Patch for clang-format to allow references and pointers to bind differently
Alp Toker
alp at nuanti.com
Thu Dec 5 02:57:12 PST 2013
On 05/12/2013 10:10, Daniel Jasper wrote:
> As I have mentioned before, I don't think this is a useful feature
> (let alone being a very intrusive change on the current codebase).
> Whenever we have done anything into this direction, we have been
> getting the feedback that it is not helpful. People want automatically
> enforceable styles and the consistency it brings them. Bailing out of
> doing specific changes is not the solution.
Then what is the solution?
Skipping an unenforceable format style seems to offer 99% of the
benefits of the tool.
The user can then potentially do remaining polishing with a perl script
or something if they want complete enforceability of an unusual style.
If they want full enforceability then I think it's reasonable to expect
users to stay close to the currently supported styles. Not convinced
that offering yet another way of formatting pointer formatting is the
way to go.
The strategy also makes sense for column width violations when
formatting comments. Right now clang-format pushes a dangling word the
next line, which is enforcing something, but not what anyone wants.
If clang-format were to leave the line it didn't understand how to
reflow untouched (maybe with a note to stderr), it'd be easier to get to
a finished result with another tool or manually.
Of course if this is work to implement, then the other option might be
easier. It's just I was under the impression ignoring an edit would be
straightforward, which might not be the case in TokenAnnotator.cpp :-)
Alp.
>
> On Thu, Dec 5, 2013 at 10:39 AM, Alp Toker <alp at nuanti.com
> <mailto:alp at nuanti.com>> wrote:
>
>
> On 04/12/2013 22:45, Daniel Jasper wrote:
>
> --detect-style will be nice, but it is going to be
> significantly more effort than you might think.
>
>
> Returning to my idea to "leave X formatting untouched", I imagine
> this might give Ben a chance to get usage out of the tool while
> also becoming a first step towards --detect-style.
>
> The algorithm would be roughly:
>
> for each formatting criterion X, apply X alone to the in-memory
> buffer and count deltas. Report ambiguity if Xn == 0, otherwise
> select X with lowest number of deltas as the detected style variable.
>
> I'm sure there are other ways to do it, so just throwing about the
> idea if only to avoid the perennial debate on what constitutes
> acceptable corner-case styles :-)
>
> Alp.
>
>
> --
> http://www.nuanti.com
> the browser experts
>
>
--
http://www.nuanti.com
the browser experts
More information about the cfe-commits
mailing list