[PATCH] D43821: [SemaCXX] _Pragma("clang optimize off") not affecting lambda.

Carlos Alberto Enciso via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 8 02:09:02 PST 2018

CarlosAlbertoEnciso added inline comments.

Comment at: lib/Sema/SemaDecl.cpp:12598
+    // have to apply optnone due to a pragma.
+    AddRangeBasedOptnone(FD);
erichkeane wrote:
> Should thi sonly happen if this is a definition?  Additionally, does this negate the need for the other call to this in ActOnFunctionDeclarator?
First of all, thanks for your review.

Based on your comments, I found couple of issues with my patch:

For a normal function, the setting of the 'optnone' attribute was done twice:
ActOnFunctionDeclarator and ActOnFinishFunctionBody.

The setting of the 'optnone' attribute is not consistent for both lambda and
normal functions. For normal functions being done at the start of the definition
and for lambdas at the end of the function body.

Based on the previous findings, now I am setting the 'optnone' attribute in

I will update the patch to reflect the changes.

  rC Clang


More information about the cfe-commits mailing list