owenpan added inline comments.
================ Comment at: clang/lib/Format/TokenAnnotator.cpp:4405-4408 if (Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) && !Right.is(tok::r_square)) { - return true; + if (Right.is(tok::l_brace)) + return true; ---------------- Merge the check for `comma` below to avoid repeated code. Also, the check for `l_brace` is redundant. ================ Comment at: clang/lib/Format/TokenAnnotator.cpp:4411-4420 + const auto *Tok = &Right; + while (Tok) { + if (Tok->isOneOf(tok::l_brace, tok::l_square)) { + return true; + } + if (Tok->isOneOf(tok::r_brace, tok::r_square)) { + break; ---------------- Use a `for` loop instead. ================ Comment at: clang/lib/Format/TokenAnnotator.cpp:4426-4444 + if (Left.is(tok::comma)) { + if (Right.is(tok::l_brace)) { + return true; + } + // scan to the right if an we see an object or an array inside + // then break + const auto *Tok = &Right; ---------------- This can be deleted now. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133589/new/ https://reviews.llvm.org/D133589 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits