diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-29 01:48:07 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-29 01:48:07 +0000 |
commit | 33f04a208a1a6e73da73460142327ff05e8c391b (patch) | |
tree | 16cd0515006271d6ff031895f2ff99ed1aad586e /lib/Parse/ParseDecl.cpp | |
parent | cda7968b38d76848b4fb24f7cc28ab83835b4ea3 (diff) |
Treat alignas and _Alignas as keyword attributes. This allows us to
pretty-print them properly (modulo the more general badness in alignment
attribute printing).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index e6e010bd9c..438c6f8cf5 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -2074,15 +2074,15 @@ ExprResult Parser::ParseAlignArgument(SourceLocation Start, /// alignment-specifier: /// [C11] '_Alignas' '(' type-id ')' /// [C11] '_Alignas' '(' constant-expression ')' -/// [C++0x] 'alignas' '(' type-id ...[opt] ')' -/// [C++0x] 'alignas' '(' assignment-expression ...[opt] ')' +/// [C++11] 'alignas' '(' type-id ...[opt] ')' +/// [C++11] 'alignas' '(' assignment-expression ...[opt] ')' void Parser::ParseAlignmentSpecifier(ParsedAttributes &Attrs, SourceLocation *endLoc) { assert((Tok.is(tok::kw_alignas) || Tok.is(tok::kw__Alignas)) && "Not an alignment-specifier!"); - SourceLocation KWLoc = Tok.getLocation(); - ConsumeToken(); + IdentifierInfo *KWName = Tok.getIdentifierInfo(); + SourceLocation KWLoc = ConsumeToken(); BalancedDelimiterTracker T(*this, tok::l_paren); if (T.expectAndConsume(diag::err_expected_lparen)) @@ -2107,12 +2107,8 @@ void Parser::ParseAlignmentSpecifier(ParsedAttributes &Attrs, ExprVector ArgExprs; ArgExprs.push_back(ArgExpr.release()); - // FIXME: This should not be GNU, but we since the attribute used is - // based on the spelling, and there is no true spelling for - // C++11 attributes, this isn't accepted. - Attrs.addNew(PP.getIdentifierInfo("aligned"), KWLoc, 0, KWLoc, - 0, T.getOpenLocation(), ArgExprs.data(), 1, - AttributeList::AS_GNU); + Attrs.addNew(KWName, KWLoc, 0, KWLoc, 0, T.getOpenLocation(), + ArgExprs.data(), 1, AttributeList::AS_Keyword); } /// ParseDeclarationSpecifiers |