r282910 - [CUDA] Fix up MaybeParseGNUAttributes call used for out-of-place attributes on CUDA lambdas.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 30 12:55:49 PDT 2016


Author: jlebar
Date: Fri Sep 30 14:55:48 2016
New Revision: 282910

URL: http://llvm.org/viewvc/llvm-project?rev=282910&view=rev
Log:
[CUDA] Fix up MaybeParseGNUAttributes call used for out-of-place attributes on CUDA lambdas.

Summary: There's an overload that we can use to make this a bit cleaner.

Reviewers: rnk

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D25114

Modified:
    cfe/trunk/lib/Parse/ParseExprCXX.cpp

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=282910&r1=282909&r2=282910&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Fri Sep 30 14:55:48 2016
@@ -1128,12 +1128,10 @@ ExprResult Parser::ParseLambdaExpression
 
   ParsedAttributes Attr(AttrFactory);
   SourceLocation DeclLoc = Tok.getLocation();
-  SourceLocation DeclEndLoc = DeclLoc;
   if (getLangOpts().CUDA) {
     // In CUDA code, GNU attributes are allowed to appear immediately after the
     // "[...]", even if there is no "(...)" before the lambda body.
-    MaybeParseGNUAttributes(Attr, &DeclEndLoc);
-    D.takeAttributes(Attr, DeclEndLoc);
+    MaybeParseGNUAttributes(D);
   }
 
   TypeResult TrailingReturnType;
@@ -1161,7 +1159,7 @@ ExprResult Parser::ParseLambdaExpression
     }
     T.consumeClose();
     SourceLocation RParenLoc = T.getCloseLocation();
-    DeclEndLoc = RParenLoc;
+    SourceLocation DeclEndLoc = RParenLoc;
 
     // GNU-style attributes must be parsed before the mutable specifier to be
     // compatible with GCC.
@@ -1253,7 +1251,7 @@ ExprResult Parser::ParseLambdaExpression
     Diag(Tok, diag::err_lambda_missing_parens)
       << TokKind
       << FixItHint::CreateInsertion(Tok.getLocation(), "() ");
-    DeclEndLoc = DeclLoc;
+    SourceLocation DeclEndLoc = DeclLoc;
 
     // GNU-style attributes must be parsed before the mutable specifier to be
     // compatible with GCC.




More information about the cfe-commits mailing list