djasper added inline comments.
================ Comment at: lib/Format/UnwrappedLineParser.cpp:297 case tok::kw_default: + if (Style.Language != FormatStyle::LK_Java || !Line->MustBeDeclaration) { + if (!SwitchLabelEncountered && ---------------- Same as below. ================ Comment at: lib/Format/UnwrappedLineParser.cpp:865 case tok::kw_default: - nextToken(); - parseLabel(); - return; + if (Style.Language != FormatStyle::LK_Java || !Line->MustBeDeclaration) { + nextToken(); ---------------- Change the order here. I.e. if (Style.Language == FormatStyle::LK_Java && Line->MustBeDeclaration) break; ... I think then you almost don't even need the comment. ================ Comment at: lib/Format/UnwrappedLineParser.cpp:870 + } + // 'default' can appear in a Java 8 declaration. Parse it as such. + break; ---------------- Is there a test case that hits this codepath? IIUC, it would need to have a "default" of a declaration that's not at the start of the line. https://reviews.llvm.org/D27377 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits