summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-10-07 09:15:41 +0000
committerManuel Klimek <klimek@google.com>2013-10-07 09:15:41 +0000
commit91e48586ae1e49d56895645fd219462a421bd479 (patch)
treed9232dacb34d9276da482322df5da6ac4e3b0559
parent39ff5f6702ee2c67042e809c94564459c298ea74 (diff)
downloadbcm5719-llvm-91e48586ae1e49d56895645fd219462a421bd479.tar.gz
bcm5719-llvm-91e48586ae1e49d56895645fd219462a421bd479.zip
Fix incorrect detection of class definitions with alignas specification.
llvm-svn: 192094
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp3
-rw-r--r--clang/unittests/Format/FormatTest.cpp1
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 605aebad02b..d8aa3f383da 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/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/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 85813bcaffc..6bb38e92f87 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/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;");
OpenPOWER on IntegriCloud