Page MenuHomePhabricator

[ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style
ClosedPublic

Authored by benhamilton on Dec 13 2017, 12:52 PM.

Details

Summary

If we write the following code, it goes over 100 columns, so we need to wrap it:

- (VeryLongReturnTypeName)veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
                              longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;

Currently, clang-format with the google style aligns the method parameter names on the first column:

- (VeryLongReturnTypeName)
veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
    longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;

We'd like clang-format in the google style to align these to column 4 for Objective-C:

- (VeryLongReturnTypeName)
    veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
            longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;

Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Diff Detail

Repository
rC Clang

Event Timeline

benhamilton created this revision.Dec 13 2017, 12:52 PM
benhamilton edited the summary of this revision. (Show Details)Dec 13 2017, 2:19 PM
djasper accepted this revision.Dec 13 2017, 11:51 PM
djasper added inline comments.
unittests/Format/FormatTestObjC.cpp
387

Set Style.ColumnLimit to something lower so that you don't have to wrap single lines (for better test readability).

This revision is now accepted and ready to land.Dec 13 2017, 11:51 PM
benhamilton marked an inline comment as done.
  • Use 40 column limit for test.
benhamilton added inline comments.Dec 14 2017, 8:16 AM
unittests/Format/FormatTestObjC.cpp
387

Good call, done. I was wondering why tests were doing that, should have realized.

This revision was automatically updated to reflect the committed changes.