clang-format: Fix incorrect detection of QT-signals access specifier.
authorDaniel Jasper <djasper@google.com>
Wed, 27 Jul 2016 10:13:24 +0000 (10:13 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 27 Jul 2016 10:13:24 +0000 (10:13 +0000)
Before:
  void f() {
  label:
    signals
    .baz();
  }

After:
  void f() {
  label:
    signals.baz();
  }

llvm-svn: 276854

clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp

index 2fe7298..9f79ba6 100644 (file)
@@ -906,8 +906,8 @@ void UnwrappedLineParser::parseStructuralElement() {
       if (FormatTok->is(tok::colon)) {
         nextToken();
         addUnwrappedLine();
+        return;
       }
-      return;
     }
     // In all other cases, parse the declaration.
     break;
index 8d46ba6..a3e4d3e 100644 (file)
@@ -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) {