Page MenuHomePhabricator

[clang-format] Don't insert space between r_paren and 'new' in ObjC decl

Authored by benhamilton on Mar 20 2018, 10:22 AM.



Previously, clang-format would insert a space between
the closing parenthesis and 'new' in the following valid Objective-C

+ (instancetype)new;

This was because 'new' is treated as a keyword, not an identifier.

TokenAnnotator::spaceRequiredBefore() already handled the case where
r_paren came before an identifier, so this diff extends it to
handle r_paren before 'new'.

Test Plan: New tests added. Ran tests with:

% make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Diff Detail


Event Timeline

benhamilton created this revision.Mar 20 2018, 10:22 AM
stephanemoore accepted this revision.Mar 20 2018, 2:17 PM

Makes sense to me.

This revision is now accepted and ready to land.Mar 20 2018, 2:17 PM
jolesiak accepted this revision.Mar 21 2018, 5:23 AM
djasper accepted this revision.Mar 21 2018, 8:05 AM

Looks good.

This revision was automatically updated to reflect the committed changes.