]> granicus.if.org Git - clang/commitdiff
Fix incorrect detection of class definitions with alignas specification.
authorManuel Klimek <klimek@google.com>
Mon, 7 Oct 2013 09:15:41 +0000 (09:15 +0000)
committerManuel Klimek <klimek@google.com>
Mon, 7 Oct 2013 09:15:41 +0000 (09:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192094 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTest.cpp

index 605aebad02b9971b721623f45f81c6037b7a3f5d..d8aa3f383da4c0566c90a67fe27d3c37542d0de8 100644 (file)
@@ -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)) {
index 85813bcaffc2fcbc0cf255d41fd87dbf404c2d69..6bb38e92f87c7169456f7e720c975e05f36421ca 100644 (file)
@@ -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;");