From: Manuel Klimek Date: Mon, 7 Oct 2013 09:15:41 +0000 (+0000) Subject: Fix incorrect detection of class definitions with alignas specification. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d712898fcabf5747db25dac497747572d506c7a;p=clang Fix incorrect detection of class definitions with alignas specification. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192094 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 605aebad02..d8aa3f383d 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -1069,7 +1069,8 @@ 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___declspec) || + FormatTok->Tok.is(tok::kw_alignas)) { nextToken(); // We can have macros or attributes in between 'class' and the class name. if (FormatTok->Tok.is(tok::l_paren)) { diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 85813bcaff..6bb38e92f8 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -4468,6 +4468,7 @@ TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) { verifyFormat("class __attribute__(X) Z {\n} n;"); verifyFormat("class __declspec(X) Z {\n} n;"); verifyFormat("class A##B##C {\n} n;"); + verifyFormat("class alignas(16) Z {\n} n;"); // Redefinition from nested context: verifyFormat("class A::B::C {\n} n;");