Skip to content

Commit 7853215

Browse files
committed
Set FP features in Sema methods
1 parent 463a99a commit 7853215

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

clang/lib/Parse/ParseCXXInlineMethods.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,10 +603,7 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) {
603603
// to be re-used for method bodies as well.
604604
ParseScope FnScope(this, Scope::FnScope | Scope::DeclScope |
605605
Scope::CompoundStmtScope);
606-
607-
// Some function attributes (like OptimizeNoneAttr) affect FP options.
608606
Sema::FPFeaturesStateRAII SaveFPFeatures(Actions);
609-
Actions.applyFunctionAttributesBeforeParsingBody(LM.D);
610607

611608
Actions.ActOnStartOfFunctionDef(getCurScope(), LM.D);
612609

clang/lib/Parse/ParseObjc.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3736,9 +3736,7 @@ void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM, bool parseMethod) {
37363736
ParseScope BodyScope(this, (parseMethod ? Scope::ObjCMethodScope : 0) |
37373737
Scope::FnScope | Scope::DeclScope |
37383738
Scope::CompoundStmtScope);
3739-
// Some function attributes (like OptimizeNoneAttr) affect FP options.
37403739
Sema::FPFeaturesStateRAII SaveFPFeatures(Actions);
3741-
Actions.applyFunctionAttributesBeforeParsingBody(LM.D);
37423740

37433741
// Tell the actions module that we have entered a method or c-function definition
37443742
// with the specified Declarator for the method/function.

clang/lib/Parse/ParseTemplate.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,10 +1651,6 @@ void Parser::ParseLateTemplatedFuncDef(LateParsedTemplate &LPT) {
16511651
// Recreate the containing function DeclContext.
16521652
Sema::ContextRAII FunctionSavedContext(Actions, FunD->getLexicalParent());
16531653

1654-
// Some function attributes (like OptimizeNoneAttr) affect FP options.
1655-
Sema::FPFeaturesStateRAII SaveFPFeatures(Actions);
1656-
Actions.applyFunctionAttributesBeforeParsingBody(LPT.D);
1657-
16581654
Actions.ActOnStartOfFunctionDef(getCurScope(), FunD);
16591655

16601656
if (Tok.is(tok::kw_try)) {

clang/lib/Parse/Parser.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,9 +1497,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
14971497
return Actions.ActOnFinishFunctionBody(Res, nullptr, false);
14981498
}
14991499

1500-
// Some function attributes (like OptimizeNoneAttr) affect FP options.
15011500
Sema::FPFeaturesStateRAII SaveFPFeatures(Actions);
1502-
Actions.applyFunctionAttributesBeforeParsingBody(Res);
15031501

15041502
if (Tok.is(tok::kw_try))
15051503
return ParseFunctionTryBlock(Res, BodyScope);

clang/lib/Sema/SemaDecl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15899,6 +15899,11 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D,
1589915899
FD->setInvalidDecl();
1590015900
return D;
1590115901
}
15902+
15903+
// Some function attributes (like OptimizeNoneAttr) need actions before
15904+
// parsing body started.
15905+
applyFunctionAttributesBeforeParsingBody(D);
15906+
1590215907
// We want to attach documentation to original Decl (which might be
1590315908
// a function template).
1590415909
ActOnDocumentableDecl(D);

clang/lib/Sema/SemaDeclObjC.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
494494
}
495495
}
496496
}
497+
498+
// Some function attributes (like OptimizeNoneAttr) need actions before
499+
// parsing body started.
500+
applyFunctionAttributesBeforeParsingBody(D);
497501
}
498502

499503
namespace {

0 commit comments

Comments
 (0)