This is an archive of the discontinued LLVM Phabricator instance.

clang-format: distinguish ObjC call subexpressions after r355434
ClosedPublic

Authored by krasimir on Mar 11 2019, 7:19 AM.

Details

Summary

The revision r355434 had the unfortunate side-effect that it started to
recognize certain ObjC expressions with a call subexpression followed by a
a->b subexpression as C++ lambda expressions.

This patch adds a bit of logic to handle these cases and documents them in
tests.

The commented-out test cases in the new test suite are ones that were
problematic before r355434.

Diff Detail

Repository
rL LLVM

Event Timeline

krasimir created this revision.Mar 11 2019, 7:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2019, 7:19 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
krasimir edited the summary of this revision. (Show Details)Mar 11 2019, 7:21 AM
This revision is now accepted and ready to land.Mar 11 2019, 7:27 AM

most of the cases that we were adding here were for a templated return types

e.g.

verifyFormat("[]() -> foo<5 + 2> { return {}; };");
verifyFormat("[]() -> foo<5 - 2> { return {}; };");

So we should probably have handle that "-> (return type)", where the return type contains <XXX> separately, where those operation tokens are inside the XXX

gribozavr accepted this revision.Mar 11 2019, 8:33 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2019, 9:04 AM