diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 905f9c1ba5fdf792c4a8df97ae357fedba4f5734..2aa4414d67ac2bd4098f5701f1f402dd83a6826b 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -754,7 +754,11 @@ void UnwrappedLineParser::parseStructuralElement() { return; } if (FormatTok->is(Keywords.kw_signals)) { - parseAccessSpecifier(); + nextToken(); + if (FormatTok->is(tok::colon)) { + nextToken(); + addUnwrappedLine(); + } return; } // In all other cases, parse the declaration. diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 6e2b95052383dbc428e751e9e60a3b049fe58655..a891ba2a67920a765fdfaa23b2b66e0e3b465b52 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -1900,6 +1900,10 @@ TEST_F(FormatTest, UnderstandsAccessSpecifiers) { "signals:\n" " void g();\n" "};"); + + // Don't interpret 'signals' the wrong way. + verifyFormat("signals.set();"); + verifyFormat("for (Signals signals : f()) {\n}"); } TEST_F(FormatTest, SeparatesLogicalBlocks) {