[cfe-commits] r142760 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td include/clang/Parse/Parser.h lib/Parse/ParseDecl.cpp lib/Sema/SemaDeclAttr.cpp test/CXX/temp/temp.decls/temp.variadic/p5.cpp test/SemaCXX/attr-cxx0x.cpp

Douglas Gregor dgregor at apple.com
Mon Oct 24 07:34:04 PDT 2011


On Oct 23, 2011, at 1:07 PM, Peter Collingbourne wrote:

> Author: pcc
> Date: Sun Oct 23 15:07:52 2011
> New Revision: 142760
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=142760&view=rev
> Log:
> Fix grammar for C++11 alignment specifiers, and add a few FIXMEs.
> 
> Modified:
>    cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>    cfe/trunk/include/clang/Parse/Parser.h
>    cfe/trunk/lib/Parse/ParseDecl.cpp
>    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>    cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
>    cfe/trunk/test/SemaCXX/attr-cxx0x.cpp
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=142760&r1=142759&r2=142760&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Sun Oct 23 15:07:52 2011
> @@ -427,6 +427,8 @@
> def err_cxx0x_attribute_requires_arguments : Error<
>   "C++11 attribute '%0' must have an argument list">;
> def err_attributes_not_allowed : Error<"an attribute list cannot appear here">;
> +def err_alignas_pack_exp_unsupported : Error<
> +  "pack expansions in alignment specifiers are not supported yet">;
> 
> /// C++ Templates
> def err_expected_template : Error<"expected template">;
> 
> Modified: cfe/trunk/include/clang/Parse/Parser.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=142760&r1=142759&r2=142760&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Parse/Parser.h (original)
> +++ cfe/trunk/include/clang/Parse/Parser.h Sun Oct 23 15:07:52 2011
> @@ -1853,7 +1853,8 @@
>   void ParseUnderlyingTypeSpecifier(DeclSpec &DS);
>   void ParseAtomicSpecifier(DeclSpec &DS);
> 
> -  ExprResult ParseAlignArgument(SourceLocation Start);
> +  ExprResult ParseAlignArgument(SourceLocation Start,
> +                                SourceLocation &EllipsisLoc);
>   void ParseAlignmentSpecifier(ParsedAttributes &Attrs,
>                                SourceLocation *endLoc = 0);
> 
> 
> Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=142760&r1=142759&r2=142760&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseDecl.cpp Sun Oct 23 15:07:52 2011
> @@ -1552,19 +1552,28 @@
> /// FIXME: Simply returns an alignof() expression if the argument is a
> /// type. Ideally, the type should be propagated directly into Sema.
> ///
> -/// [C1X/C++0x] type-id
> -/// [C1X]       constant-expression
> -/// [C++0x]     assignment-expression
> -ExprResult Parser::ParseAlignArgument(SourceLocation Start) {
> +/// [C1X]   type-id
> +/// [C1X]   constant-expression
> +/// [C++0x] type-id ...[opt]
> +/// [C++0x] assignment-expression ...[opt]
> +ExprResult Parser::ParseAlignArgument(SourceLocation Start,
> +                                      SourceLocation &EllipsisLoc) {
> +  ExprResult ER;
>   if (isTypeIdInParens()) {
> -    EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
>     SourceLocation TypeLoc = Tok.getLocation();
>     ParsedType Ty = ParseTypeName().get();
>     SourceRange TypeRange(Start, Tok.getLocation());
> -    return Actions.ActOnUnaryExprOrTypeTraitExpr(TypeLoc, UETT_AlignOf, true,
> -                                                Ty.getAsOpaquePtr(), TypeRange);
> +    ER = Actions.ActOnUnaryExprOrTypeTraitExpr(TypeLoc, UETT_AlignOf, true,
> +                                               Ty.getAsOpaquePtr(), TypeRange);
>   } else
> -    return ParseConstantExpression();
> +    ER = ParseConstantExpression();
> +
> +  if (getLang().CPlusPlus0x && Tok.is(tok::ellipsis)) {
> +    EllipsisLoc = Tok.getLocation();
> +    ConsumeToken();
> +  }

It would be slightly shorter to use

  EllipsisLoc = ConsumeToken()

	- Doug




More information about the cfe-commits mailing list