[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 20 10:24:20 PDT 2024
================
@@ -1495,6 +1495,10 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
return Actions.ActOnFinishFunctionBody(Res, nullptr, false);
}
+ // Some function attributes (like OptimizeNoneAttr) affect FP options.
+ Sema::FPFeaturesStateRAII SaveFPFeatures(Actions);
+ Actions.applyFunctionAttributesBeforeParsingBody(Res);
----------------
rjmccall wrote:
Hmm. There are actually a lot of paths that call into `ParseFunctionStatementBody` like this. Rather than changing all of them, can we just do this in `ActOnStartOfFunctionDef` / `ActOnFinishFunctionBody`? We do a lot of similar context push/pop operations there already.
Please test an inline C++ method (which are delayed and use a different path) and ObjC method parsing (which also use a different path).
https://github.com/llvm/llvm-project/pull/85605
More information about the cfe-commits
mailing list