r192094 - Fix incorrect detection of class definitions with alignas specification.
Manuel Klimek
klimek at google.com
Mon Oct 7 02:15:42 PDT 2013
Author: klimek
Date: Mon Oct 7 04:15:41 2013
New Revision: 192094
URL: http://llvm.org/viewvc/llvm-project?rev=192094&view=rev
Log:
Fix incorrect detection of class definitions with alignas specification.
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=192094&r1=192093&r2=192094&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Mon Oct 7 04:15:41 2013
@@ -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)) {
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=192094&r1=192093&r2=192094&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Oct 7 04:15:41 2013
@@ -4468,6 +4468,7 @@ TEST_F(FormatTest, UnderstandContextOfRe
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;");
More information about the cfe-commits
mailing list