This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix PR30527: Regression when clang-format insert spaces in [] when in template
ClosedPublic

Authored by branko on Oct 31 2016, 2:16 PM.

Details

Reviewers
djasper
Summary

Actual regression was introduced in r272668. This revision fixes JS script, but also regress Cpp case. It manifests with spaces added when template is followed with array. Bug 30527 mentions case of array as a nested template type (foo<bar<baz>[]>). Fix is to detect such case and to prevent treating it as array initialization, but as a subscript case. However, before r272668, this case was treated simple because we were detecting it as a StartsObjCMethodExpr. Same was true for other similar case - array of templates (foo<int>[]). This patch tries to address two problems: 1) fixing regression 2) making sure both cases (array as a nested type, array of templates) which were entering StartsObjCMethodExpr branch are handled now appropriately.

Diff Detail

Event Timeline

branko updated this revision to Diff 76477.Oct 31 2016, 2:16 PM
branko retitled this revision from to [clang-format] Fix PR30527: Regression when clang-format insert spaces in [] when in template.
branko updated this object.
branko added a reviewer: djasper.
branko added a subscriber: cfe-commits.
djasper accepted this revision.Nov 10 2016, 7:53 AM
djasper edited edge metadata.

Looks good. Thank you!

This revision is now accepted and ready to land.Nov 10 2016, 7:53 AM

Thanks. @djasper - can you commit this for me, please?

thakis closed this revision.Nov 10 2016, 1:59 PM
thakis added a subscriber: thakis.

Landed in r286507. Thanks!