krasimir added a comment. 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. ================ Comment at: clang/lib/Format/TokenAnnotator.cpp:44 +/// With `Left` being '(', check if we're at either `[...](` or +/// `...]<...>(`. +static bool isLambdaParameterList(const FormatToken *Left) { ---------------- 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]()`. ================ Comment at: clang/lib/Format/TokenAnnotator.cpp:50 + // Skip <...> if present. + if (Left->Previous && Left->Previous->is(tok::greater) && + Left->Previous->MatchingParen && ---------------- The first `Left->Previous` check is unnecessary here, following the previous `if`. ================ Comment at: clang/lib/Format/TokenAnnotator.cpp:55 + + // Check for `[...](`. + return Left->Previous && Left->Previous->is(tok::r_square) && ---------------- nit: consider replacing with ``` Check for `[...]` ``` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67246/new/ https://reviews.llvm.org/D67246 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits