3131namespace clang {
3232class IdentifierInfo ;
3333class OpenACCClause ;
34+ class Scope ;
3435
3536class SemaOpenACC : public SemaBase {
3637public:
@@ -172,6 +173,9 @@ class SemaOpenACC : public SemaBase {
172173 // check them later.
173174 llvm::SmallDenseMap<const clang::FunctionDecl *, SourceLocation>
174175 MagicStaticLocs;
176+ OpenACCRoutineDecl *LastRoutineDecl = nullptr ;
177+
178+ void CheckLastRoutineDeclNameConflict (const NamedDecl *ND);
175179
176180public:
177181 ComputeConstructInfo &getActiveComputeConstructInfo () {
@@ -763,10 +767,37 @@ class SemaOpenACC : public SemaBase {
763767
764768 // / Called after the directive has been completely parsed, including the
765769 // / declaration group or associated statement.
766- DeclGroupRef ActOnEndDeclDirective (
767- OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc,
768- SourceLocation LParenLoc, Expr *FuncRef, SourceLocation RParenLoc,
769- SourceLocation EndLoc, ArrayRef<OpenACCClause *> Clauses);
770+ DeclGroupRef
771+ ActOnEndDeclDirective (OpenACCDirectiveKind K, SourceLocation StartLoc,
772+ SourceLocation DirLoc, SourceLocation LParenLoc,
773+ SourceLocation RParenLoc, SourceLocation EndLoc,
774+ ArrayRef<OpenACCClause *> Clauses);
775+
776+ // Helper functions for ActOnEndRoutine*Directive, which does all the checking
777+ // given the proper list of declarations.
778+ void CheckRoutineDecl (SourceLocation DirLoc,
779+ ArrayRef<const OpenACCClause *> Clauses,
780+ Decl *NextParsedDecl);
781+ OpenACCRoutineDecl *CheckRoutineDecl (SourceLocation StartLoc,
782+ SourceLocation DirLoc,
783+ SourceLocation LParenLoc, Expr *FuncRef,
784+ SourceLocation RParenLoc,
785+ ArrayRef<const OpenACCClause *> Clauses,
786+ SourceLocation EndLoc);
787+ OpenACCRoutineDeclAttr *
788+ mergeRoutineDeclAttr (const OpenACCRoutineDeclAttr &Old);
789+ DeclGroupRef
790+ ActOnEndRoutineDeclDirective (SourceLocation StartLoc, SourceLocation DirLoc,
791+ SourceLocation LParenLoc, Expr *ReferencedFunc,
792+ SourceLocation RParenLoc,
793+ ArrayRef<const OpenACCClause *> Clauses,
794+ SourceLocation EndLoc, DeclGroupPtrTy NextDecl);
795+ StmtResult
796+ ActOnEndRoutineStmtDirective (SourceLocation StartLoc, SourceLocation DirLoc,
797+ SourceLocation LParenLoc, Expr *ReferencedFunc,
798+ SourceLocation RParenLoc,
799+ ArrayRef<const OpenACCClause *> Clauses,
800+ SourceLocation EndLoc, Stmt *NextStmt);
770801
771802 // / Called when encountering an 'int-expr' for OpenACC, and manages
772803 // / conversions and diagnostics to 'int'.
@@ -780,8 +811,14 @@ class SemaOpenACC : public SemaBase {
780811 // / Helper function called by ActonVar that is used to check a 'cache' var.
781812 ExprResult ActOnCacheVar (Expr *VarExpr);
782813 // / Function called when a variable declarator is created, which lets us
783- // / impelment the 'routine' 'function static variables' restriction.
814+ // / implement the 'routine' 'function static variables' restriction.
784815 void ActOnVariableDeclarator (VarDecl *VD);
816+ // / Called when a function decl is created, which lets us implement the
817+ // / 'routine' 'doesn't match next thing' warning.
818+ void ActOnFunctionDeclarator (FunctionDecl *FD);
819+ // / Called when a variable is initialized, so we can implement the 'routine
820+ // / 'doesn't match the next thing' warning for lambda init.
821+ void ActOnVariableInit (VarDecl *VD, QualType InitType);
785822
786823 // Called after 'ActOnVar' specifically for a 'link' clause, which has to do
787824 // some minor additional checks.
0 commit comments