r235702 - clang-format: More selectively detect QT's "signals".
Daniel Jasper
djasper at google.com
Fri Apr 24 00:50:34 PDT 2015
Author: djasper
Date: Fri Apr 24 02:50:34 2015
New Revision: 235702
URL: http://llvm.org/viewvc/llvm-project?rev=235702&view=rev
Log:
clang-format: More selectively detect QT's "signals".
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=235702&r1=235701&r2=235702&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Fri Apr 24 02:50:34 2015
@@ -754,7 +754,11 @@ void UnwrappedLineParser::parseStructura
return;
}
if (FormatTok->is(Keywords.kw_signals)) {
- parseAccessSpecifier();
+ nextToken();
+ if (FormatTok->is(tok::colon)) {
+ nextToken();
+ addUnwrappedLine();
+ }
return;
}
// In all other cases, parse the declaration.
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=235702&r1=235701&r2=235702&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Apr 24 02:50:34 2015
@@ -1900,6 +1900,10 @@ TEST_F(FormatTest, UnderstandsAccessSpec
"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) {
More information about the cfe-commits
mailing list