Fix parsing of classes where the class name is an absolute nested name specifier.

llvm-svn: 214393
This commit is contained in:
Manuel Klimek 2014-07-31 07:19:30 +00:00
parent 87c046189d
commit 45bf56cdf9
2 changed files with 3 additions and 4 deletions

View File

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

View File

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