diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 2fe72987bc7ce21dbecbd3f7ec77be8355f18163..9f79ba60f39febef6e7728700d5dcee74931369b 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -906,8 +906,8 @@ void UnwrappedLineParser::parseStructuralElement() { if (FormatTok->is(tok::colon)) { nextToken(); addUnwrappedLine(); + return; } - return; } // In all other cases, parse the declaration. break; diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 8d46ba6efcfeecd093d9923056a24115187a5988..a3e4d3edfffe3798c5ac6285895f9ef5357fb2dd 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -1934,6 +1934,10 @@ TEST_F(FormatTest, UnderstandsAccessSpecifiers) { verifyFormat("{\n" " signals.set(); // This needs indentation.\n" "}"); + verifyFormat("void f() {\n" + "label:\n" + " signals.baz();\n" + "}"); } TEST_F(FormatTest, SeparatesLogicalBlocks) {