[PATCH] D25114: [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 11:37:51 PDT 2016


jlebar created this revision.
jlebar added a reviewer: rnk.
jlebar added subscribers: tra, cfe-commits.

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


https://reviews.llvm.org/D25114

Files:
  clang/lib/Parse/ParseExprCXX.cpp


Index: clang/lib/Parse/ParseExprCXX.cpp
===================================================================
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -1128,12 +1128,10 @@
 
   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 @@
     }
     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 @@
     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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25114.73104.patch
Type: text/x-patch
Size: 1297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160930/954530b9/attachment.bin>


More information about the cfe-commits mailing list