Page MenuHomePhabricator

Add option to disable alignment after opening bracket
ClosedPublic

Authored by het on Nov 17 2014, 10:54 AM.

Details

Reviewers
djasper
Summary

clang-format: Adds option to disable alignment after opening bracket

Diff Detail

Event Timeline

het updated this revision to Diff 16296.Nov 17 2014, 10:54 AM
het retitled this revision from to Add option to disable alignment of function declaration parentheses.
het updated this object.
het edited the test plan for this revision. (Show Details)
het added a reviewer: djasper.
het set the repository for this revision to rL LLVM.
het added a subscriber: Unknown Object (MLST).
het added a comment.Nov 17 2014, 10:56 AM

I like the idea of an option to disable alignment for all parentheses. Should it be extended to all "scope openers"?

het updated this revision to Diff 16310.Nov 17 2014, 4:13 PM
het retitled this revision from Add option to disable alignment of function declaration parentheses to Add option to disable alignment after opening bracket.
het updated this object.
het updated this revision to Diff 16315.Nov 17 2014, 6:35 PM
djasper added inline comments.Nov 18 2014, 1:43 AM
include/clang/Format/Format.h
233

Maybe add: "This applies to round brackets (parentheses), angle brackets and square brackets."

lib/Format/ContinuationIndenter.cpp
304–306

If we apply to all brackets, then this should mostly just go away, right?

Also, generally try to add at least one test for the different cases handled here. Just removing everything but "Style.AlignAfterOpenABracket" doesn't break any tests.

739–742

I think most of this can go away if we really want to disable alignment for all parentheses.

het updated this revision to Diff 16348.Nov 18 2014, 1:22 PM
djasper accepted this revision.Nov 18 2014, 3:54 PM
djasper edited edge metadata.

Looks good, I'll submit.

This revision is now accepted and ready to land.Nov 18 2014, 3:54 PM
djasper closed this revision.Nov 18 2014, 3:55 PM

Submitted in r222284. Thank you!