From 31343832e708c5db2fc7bfc562d343dcee8f156b Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Wed, 27 Jul 2016 10:13:24 +0000 Subject: [PATCH] clang-format: Fix incorrect detection of QT-signals access specifier. Before: void f() { label: signals .baz(); } After: void f() { label: signals.baz(); } llvm-svn: 276854 --- clang/lib/Format/UnwrappedLineParser.cpp | 2 +- clang/unittests/Format/FormatTest.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 2fe7298..9f79ba6 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/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/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 8d46ba6..a3e4d3e 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/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) { -- 2.7.4