clang-format: Support Qt's slot access specifiers.

This fixes llvm.org/PR17241.

llvm-svn: 195555
This commit is contained in:
Daniel Jasper 2013-11-23 17:53:41 +00:00
parent edaa444bda
commit 84c47a1074
2 changed files with 7 additions and 0 deletions

View File

@ -1086,6 +1086,9 @@ void UnwrappedLineParser::parseSwitch() {
void UnwrappedLineParser::parseAccessSpecifier() {
nextToken();
// Understand Qt's slots.
if (FormatTok->is(tok::identifier) && FormatTok->TokenText == "slots")
nextToken();
// Otherwise, we don't know what it is, and we'd better keep the next token.
if (FormatTok->Tok.is(tok::colon))
nextToken();

View File

@ -1537,6 +1537,10 @@ TEST_F(FormatTest, UnderstandsAccessSpecifiers) {
" private:\n"
" void f() {}\n"
"};");
verifyFormat("class A {\n"
"public slots:\n"
" void f() {}\n"
"};");
}
TEST_F(FormatTest, SeparatesLogicalBlocks) {