clang-format: More selectively detect QT's "signals".

llvm-svn: 235702
This commit is contained in:
Daniel Jasper 2015-04-24 07:50:34 +00:00
parent 8dee8575c6
commit de0d1f3c26
2 changed files with 9 additions and 1 deletions

View File

@ -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.

View File

@ -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) {