@@ -167,6 +167,11 @@ class SemaOpenACC : public SemaBase {
167167 // contexts, we can just store the declaration and location of the reference.
168168 llvm::DenseMap<const clang::DeclaratorDecl *, SourceLocation>
169169 DeclareVarReferences;
170+ // The 'routine' construct disallows magic-statics in a function referred to
171+ // by a 'routine' directive. So record any of these that we see so we can
172+ // check them later.
173+ llvm::SmallDenseMap<const clang::FunctionDecl *, SourceLocation>
174+ MagicStaticLocs;
170175
171176public:
172177 ComputeConstructInfo &getActiveComputeConstructInfo () {
@@ -723,6 +728,7 @@ class SemaOpenACC : public SemaBase {
723728 // / MiscLoc: First misc location, if necessary (not all constructs).
724729 // / Exprs: List of expressions on the construct itself, if necessary (not all
725730 // / constructs).
731+ // / FuncRef: used only for Routine, this is the function being referenced.
726732 // / AK: The atomic kind of the directive, if necessary (atomic only)
727733 // / RParenLoc: Location of the right paren, if it exists (not on all
728734 // / constructs).
@@ -735,23 +741,12 @@ class SemaOpenACC : public SemaBase {
735741 OpenACCAtomicKind AK, SourceLocation RParenLoc, SourceLocation EndLoc,
736742 ArrayRef<OpenACCClause *> Clauses, StmtResult AssocStmt);
737743
738- StmtResult ActOnEndStmtDirective (
739- OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc,
740- SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef<Expr *> Exprs,
741- SourceLocation RParenLoc, SourceLocation EndLoc,
742- ArrayRef<OpenACCClause *> Clauses, StmtResult AssocStmt) {
743- return ActOnEndStmtDirective (K, StartLoc, DirLoc, LParenLoc, MiscLoc, Exprs,
744- OpenACCAtomicKind::None, RParenLoc, EndLoc,
745- Clauses, AssocStmt);
746- }
747-
748744 // / Called after the directive has been completely parsed, including the
749745 // / declaration group or associated statement.
750- DeclGroupRef ActOnEndDeclDirective (OpenACCDirectiveKind K,
751- SourceLocation StartLoc,
752- SourceLocation DirLoc,
753- SourceLocation EndLoc,
754- ArrayRef<OpenACCClause *> Clauses);
746+ DeclGroupRef ActOnEndDeclDirective (
747+ OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc,
748+ SourceLocation LParenLoc, Expr *FuncRef, SourceLocation RParenLoc,
749+ SourceLocation EndLoc, ArrayRef<OpenACCClause *> Clauses);
755750
756751 // / Called when encountering an 'int-expr' for OpenACC, and manages
757752 // / conversions and diagnostics to 'int'.
@@ -764,6 +759,9 @@ class SemaOpenACC : public SemaBase {
764759 Expr *VarExpr);
765760 // / Helper function called by ActonVar that is used to check a 'cache' var.
766761 ExprResult ActOnCacheVar (Expr *VarExpr);
762+ // / Function called when a variable declarator is created, which lets us
763+ // / impelment the 'routine' 'function static variables' restriction.
764+ void ActOnVariableDeclarator (VarDecl *VD);
767765
768766 // Called after 'ActOnVar' specifically for a 'link' clause, which has to do
769767 // some minor additional checks.
@@ -773,6 +771,8 @@ class SemaOpenACC : public SemaBase {
773771 // checked during both phases of template translation.
774772 bool CheckDeclareClause (SemaOpenACC::OpenACCParsedClause &Clause);
775773
774+ ExprResult ActOnRoutineName (Expr *RoutineName);
775+
776776 // / Called while semantically analyzing the reduction clause, ensuring the var
777777 // / is the correct kind of reference.
778778 ExprResult CheckReductionVar (OpenACCDirectiveKind DirectiveKind,
0 commit comments