From d7fc872d5c612ecc26ccb6cca5aa7348bfc45b2b Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 6 Nov 2008 15:17:27 +0000 Subject: [PATCH] Add the remaining C++0x keywords llvm-svn: 58802 --- clang/include/clang/Basic/TokenKinds.def | 10 ++++++++++ clang/lib/Parse/ParseExpr.cpp | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def index 9b636183dd08..a557d5b9b95d 100644 --- a/clang/include/clang/Basic/TokenKinds.def +++ b/clang/include/clang/Basic/TokenKinds.def @@ -268,9 +268,19 @@ CXX_KEYWORD_OPERATOR(xor , caret) CXX_KEYWORD_OPERATOR(xor_eq , caretequal) // C++0x keywords +KEYWORD(alignof , NOTC90|NOTC99|NOTCPP) +KEYWORD(axiom , NOTC90|NOTC99|NOTCPP) KEYWORD(char16_t , NOTC90|NOTC99|NOTCPP) KEYWORD(char32_t , NOTC90|NOTC99|NOTCPP) +KEYWORD(concept , NOTC90|NOTC99|NOTCPP) +KEYWORD(concept_map , NOTC90|NOTC99|NOTCPP) +KEYWORD(constexpr , NOTC90|NOTC99|NOTCPP) +KEYWORD(decltype , NOTC90|NOTC99|NOTCPP) +KEYWORD(late_check , NOTC90|NOTC99|NOTCPP) +KEYWORD(nullptr , NOTC90|NOTC99|NOTCPP) +KEYWORD(requires , NOTC90|NOTC99|NOTCPP) KEYWORD(static_assert , NOTC90|NOTC99|NOTCPP) +KEYWORD(thread_local , NOTC90|NOTC99|NOTCPP) // GNU Extensions. KEYWORD(_Decimal32 , EXTC90|EXTC99|EXTCPP|EXTCPP0x) diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 7ab9d869c2d2..b7376954d936 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -348,6 +348,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, unsigned MinPrec) { /// 'sizeof' '(' type-name ')' /// [GNU] '__alignof' unary-expression /// [GNU] '__alignof' '(' type-name ')' +/// [C++0x] 'alignof' '(' type-id ')' /// [GNU] '&&' identifier /// /// unary-operator: one of @@ -530,8 +531,10 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) { } case tok::kw_sizeof: // unary-expression: 'sizeof' unary-expression // unary-expression: 'sizeof' '(' type-name ')' + case tok::kw_alignof: case tok::kw___alignof: // unary-expression: '__alignof' unary-expression // unary-expression: '__alignof' '(' type-name ')' + // unary-expression: 'alignof' '(' type-id ')' return ParseSizeofAlignofExpression(); case tok::ampamp: { // unary-expression: '&&' identifier SourceLocation AmpAmpLoc = ConsumeToken(); @@ -712,8 +715,10 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { /// 'sizeof' '(' type-name ')' /// [GNU] '__alignof' unary-expression /// [GNU] '__alignof' '(' type-name ')' +/// [C++0x] 'alignof' '(' type-id ')' Parser::ExprResult Parser::ParseSizeofAlignofExpression() { - assert((Tok.is(tok::kw_sizeof) || Tok.is(tok::kw___alignof)) && + assert((Tok.is(tok::kw_sizeof) || Tok.is(tok::kw___alignof) + || Tok.is(tok::kw_alignof)) && "Not a sizeof/alignof expression!"); Token OpTok = Tok; ConsumeToken();