owenpan added inline comments.
================ Comment at: clang/lib/Format/DefinitionBlockSeparator.cpp:50-64 FormatToken *CurrentToken = Line->First; + int BracketLevel = 0; while (CurrentToken) { - if (CurrentToken->isOneOf(tok::kw_class, tok::kw_struct) || - (Style.isJavaScript() && CurrentToken->is(ExtraKeywords.kw_function))) - return true; - if (!ExcludeEnum && CurrentToken->is(tok::kw_enum)) - return true; + if (BracketLevel == 0) { + if ((CurrentToken->isOneOf(tok::kw_class, tok::kw_struct, + tok::kw_union) || + (Style.isJavaScript() && ---------------- Please use a `for` loop instead: ``` for (const FormatToken *CurrentToken = Line->First; CurrentToken; CurrentToken = CurrentToken->Next) { ...; } ``` ================ Comment at: clang/lib/Format/DefinitionBlockSeparator.cpp:121-130 while (CurrentToken) { - if (CurrentToken->is(tok::kw_enum)) - FoundEnumKeyword = true; - else if (FoundEnumKeyword && CurrentToken->is(tok::l_brace)) - return true; + if (BracketLevel == 0) { + if (CurrentToken->is(tok::kw_enum)) + FoundEnumKeyword = true; + else if (FoundEnumKeyword && CurrentToken->is(tok::l_brace)) + return true; + } ---------------- Use a `for` loop with the `const FormatToken *CurrentToken` loop variable similar to the above. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D119067/new/ https://reviews.llvm.org/D119067 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits