[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 10:41:06 PDT 2024


================
@@ -2508,6 +2508,10 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope) {
   Sema::PragmaStackSentinelRAII
     PragmaStackSentinel(Actions, "InternalPragmaState", IsCXXMethod);
 
+  // Some function attributes (like OptimizeNoneAttr) affect FP options.
+  Sema::FPFeaturesStateRAII SaveFPFeatures(Actions);
+  Actions.applyFunctionAttributesBeforeParsingBody(Decl);
----------------
rjmccall wrote:

The attributes should cover the entire function body, so you're also going to need to do this before parsing function-try-blocks and constructor initializers.  That probably just means pushing it a level up across the board.

https://github.com/llvm/llvm-project/pull/85605


More information about the cfe-commits mailing list