forked from OSchip/llvm-project
clang-format: Support Qt's slot access specifiers.
This fixes llvm.org/PR17241. llvm-svn: 195555
This commit is contained in:
parent
edaa444bda
commit
84c47a1074
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue