[PATCH] D37132: [clang-format] Add support for C++17 structured bindings.

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 05:10:20 PDT 2017

djasper added a comment.

Are you changing the line endings here? Phabricator tells me that basically all the lines change. If so, please don't ;).

Comment at: lib/Format/TokenAnnotator.cpp:345
+    FormatToken *PreviousNoneOfConstVolatileReference = Parent;
+    while (PreviousNoneOfConstVolatileReference &&
I'd prefer to move this into a separate function or a lambda, i.e.:

  bool isCppStructuredBinding(const FormatToken *Tok) {
    if (!Style.isCpp() || !Tok->is(tok::l_square))
      return false;
    while (Tok && Tok->isOneOf(tok::kw_const, tok::kw_volatile, tok::amp, tok::ampamp))
      Tok = Tok->getPreviousNonComment()) {
    return Tok && Tok->is(tok::kw_auto);


More information about the cfe-commits mailing list