From: Justin Lebar Date: Fri, 30 Sep 2016 19:55:48 +0000 (+0000) Subject: [CUDA] Fix up MaybeParseGNUAttributes call used for out-of-place attributes on CUDA... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94575ae69a2e196fc9428b943967e17094bc8f4f;p=clang [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282910 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index 2287e07273..7112b9e05f 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -1128,12 +1128,10 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer( 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::ParseLambdaExpressionAfterIntroducer( } 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::ParseLambdaExpressionAfterIntroducer( 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.