r276854 - clang-format: Fix incorrect detection of QT-signals access specifier.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 03:13:25 PDT 2016


Author: djasper
Date: Wed Jul 27 05:13:24 2016
New Revision: 276854

URL: http://llvm.org/viewvc/llvm-project?rev=276854&view=rev
Log:
clang-format: Fix incorrect detection of QT-signals access specifier.

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

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

Modified:
    cfe/trunk/lib/Format/UnwrappedLineParser.cpp
    cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=276854&r1=276853&r2=276854&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Wed Jul 27 05:13:24 2016
@@ -906,8 +906,8 @@ void UnwrappedLineParser::parseStructura
       if (FormatTok->is(tok::colon)) {
         nextToken();
         addUnwrappedLine();
+        return;
       }
-      return;
     }
     // In all other cases, parse the declaration.
     break;

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=276854&r1=276853&r2=276854&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Jul 27 05:13:24 2016
@@ -1934,6 +1934,10 @@ TEST_F(FormatTest, UnderstandsAccessSpec
   verifyFormat("{\n"
                "  signals.set(); // This needs indentation.\n"
                "}");
+  verifyFormat("void f() {\n"
+               "label:\n"
+               "  signals.baz();\n"
+               "}");
 }
 
 TEST_F(FormatTest, SeparatesLogicalBlocks) {




More information about the cfe-commits mailing list