From 3d712898fcabf5747db25dac497747572d506c7a Mon Sep 17 00:00:00 2001 From: Manuel Klimek Date: Mon, 7 Oct 2013 09:15:41 +0000 Subject: [PATCH] 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 --- lib/Format/UnwrappedLineParser.cpp | 3 ++- unittests/Format/FormatTest.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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;"); -- 2.40.0