r195953 - clang-format: Correctly handle Qt's Q_SLOTS.
Daniel Jasper
djasper at google.com
Fri Nov 29 00:51:57 PST 2013
Author: djasper
Date: Fri Nov 29 02:51:56 2013
New Revision: 195953
URL: http://llvm.org/viewvc/llvm-project?rev=195953&view=rev
Log:
clang-format: Correctly handle Qt's Q_SLOTS.
This should fix llvm.org/PR17241. Maybe it sticks this time :-).
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=195953&r1=195952&r2=195953&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Fri Nov 29 02:51:56 2013
@@ -1087,7 +1087,8 @@ void UnwrappedLineParser::parseSwitch()
void UnwrappedLineParser::parseAccessSpecifier() {
nextToken();
// Understand Qt's slots.
- if (FormatTok->is(tok::identifier) && FormatTok->TokenText == "slots")
+ if (FormatTok->is(tok::identifier) &&
+ (FormatTok->TokenText == "slots" || FormatTok->TokenText == "Q_SLOTS"))
nextToken();
// Otherwise, we don't know what it is, and we'd better keep the next token.
if (FormatTok->Tok.is(tok::colon))
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=195953&r1=195952&r2=195953&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Nov 29 02:51:56 2013
@@ -1540,6 +1540,8 @@ TEST_F(FormatTest, UnderstandsAccessSpec
verifyFormat("class A {\n"
"public slots:\n"
" void f() {}\n"
+ "public Q_SLOTS:\n"
+ " void f() {}\n"
"};");
}
More information about the cfe-commits
mailing list