Ports r359967 to clang-format.
- rC371854: clang-format: Add support for formatting (some) lambdas with explicit template…
rG41f4d68a50be: clang-format: Add support for formatting (some) lambdas with explicit template…
rL371854: clang-format: Add support for formatting (some) lambdas with explicit template…
I'll need some more time to investigate the implications of this with respect to Objective-C disambiguation stuff.
Specifically, this may interact with funny ways with the heuristic outlined in (old) UnwrappedLineParser.cpp line 1453:
// In a C++ lambda a template type can only occur after an arrow. We use // this as an heuristic to distinguish between Objective-C expressions // followed by an `a->b` expression, such as: // ([obj func:arg] + a->b)
At least we'll have to update this comment accordingly, otherwise it will be confusing.
nit: add a [ in the second case, like [...]<...>(. Also I'd suggest extending this sentence with: ", where the [ opens a lambda capture list", because we explicitly check the [ for that and to disambiguate between the case this is interested in and Objective-C method calls followed by function-invocation style call, like in [obj meth]().
The first Left->Previous check is unnecessary here, following the previous if.
nit: consider replacing with
Check for `[...]`
Do you think this should land with the comment FIXME for now? It improves formatting of this language feature when that heuristic is not used, and changing the heuristic is independent of the rest of this patch.