This is an archive of the discontinued LLVM Phabricator instance.

clang-format: Add option to break after definition return type for top-level functions only
ClosedPublic

Authored by poiru on Jun 26 2015, 11:46 AM.

Details

Summary

AlwaysBreakAfterDefinitionReturnType is not compatible with Mozilla style because it breaks after the return types of inline functions in addition to top-level functions. This adds BreakAfterDefinitionReturnType with options for the existing two choices as well as a new top-level only mode.

AlwaysBreakAfterDefinitionReturnType is removed from the documentation, but still taken into account for backward compatibility.

Diff Detail

Repository
rL LLVM

Event Timeline

poiru updated this revision to Diff 28585.Jun 26 2015, 11:46 AM
poiru retitled this revision from to clang-format: Add option to break after definition return type for top-level functions only.
poiru updated this object.
poiru edited the test plan for this revision. (Show Details)
poiru added a reviewer: djasper.
poiru added a subscriber: Unknown Object (MLST).
djasper added inline comments.Jun 27 2015, 6:58 AM
docs/ClangFormatStyleOptions.rst
246 ↗(On Diff #28585)

"Auto" seems a bit "magic" here. Why not continue to call this option AlwaysBreakAfterDefinitionReturnType with the value (no, always, toplevel)? With this, I'd expect there to eventually be a never value which I don't think makes sense to implement.

poiru updated this revision to Diff 28639.Jun 28 2015, 8:25 AM

Done, although I decided to use None, All, and TopLevel.

djasper accepted this revision.Jun 29 2015, 12:35 AM
djasper edited edge metadata.

Looks good. Thank you!

docs/ClangFormatStyleOptions.rst
227–228 ↗(On Diff #28639)

This line break doesn't look good. Can you double-check why it is happening or slightly rephrase the text? Alternatively, I'll take a look after you submit.

This revision is now accepted and ready to land.Jun 29 2015, 12:35 AM
This revision was automatically updated to reflect the committed changes.