r214393 - Fix parsing of classes where the class name is an absolute nested name specifier.
Manuel Klimek
klimek at google.com
Thu Jul 31 00:19:30 PDT 2014
Author: klimek
Date: Thu Jul 31 02:19:30 2014
New Revision: 214393
URL: http://llvm.org/viewvc/llvm-project?rev=214393&view=rev
Log:
Fix parsing of classes where the class name is an absolute nested name specifier.
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=214393&r1=214392&r2=214393&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Thu Jul 31 02:19:30 2014
@@ -1327,10 +1327,8 @@ void UnwrappedLineParser::parseEnum() {
void UnwrappedLineParser::parseRecord() {
nextToken();
- if (FormatTok->Tok.is(tok::identifier) ||
- FormatTok->Tok.is(tok::kw___attribute) ||
- FormatTok->Tok.is(tok::kw___declspec) ||
- FormatTok->Tok.is(tok::kw_alignas)) {
+ if (FormatTok->isOneOf(tok::identifier, tok::coloncolon, tok::kw___attribute,
+ tok::kw___declspec, tok::kw_alignas)) {
nextToken();
// We can have macros or attributes in between 'class' and the class name.
if (FormatTok->Tok.is(tok::l_paren)) {
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=214393&r1=214392&r2=214393&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Jul 31 02:19:30 2014
@@ -1846,6 +1846,7 @@ TEST_F(FormatTest, FormatsClasses) {
verifyFormat("template <class R, class C>\n"
"struct Aaaaaaaaaaaaaaaaa<R (C::*)(int) const>\n"
" : Aaaaaaaaaaaaaaaaa<R (C::*)(int)> {};");
+ verifyFormat("class ::A::B {};");
}
TEST_F(FormatTest, FormatsVariableDeclarationsAfterStructOrClass) {
More information about the cfe-commits
mailing list