1 //===-- lib/Semantics/check-do-forall.h -------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef FORTRAN_SEMANTICS_CHECK_DO_FORALL_H_
10 #define FORTRAN_SEMANTICS_CHECK_DO_FORALL_H_
12 #include "flang/Common/idioms.h"
13 #include "flang/Semantics/semantics.h"
15 namespace Fortran::parser
{
16 struct AssignmentStmt
;
23 struct ForallAssignmentStmt
;
24 struct ForallConstruct
;
28 struct OutputImpliedDo
;
30 } // namespace Fortran::parser
32 namespace Fortran::semantics
{
34 // To specify different statement types used in semantic checking.
35 ENUM_CLASS(StmtType
, CYCLE
, EXIT
)
37 // Perform semantic checks on DO and FORALL constructs and statements.
38 class DoForallChecker
: public virtual BaseChecker
{
40 explicit DoForallChecker(SemanticsContext
&context
) : context_
{context
} {}
41 void Leave(const parser::AssignmentStmt
&);
42 void Leave(const parser::CallStmt
&);
43 void Leave(const parser::ConnectSpec
&);
44 void Enter(const parser::CycleStmt
&);
45 void Enter(const parser::DoConstruct
&);
46 void Leave(const parser::DoConstruct
&);
47 void Enter(const parser::ForallConstruct
&);
48 void Leave(const parser::ForallConstruct
&);
49 void Enter(const parser::ForallStmt
&);
50 void Leave(const parser::ForallStmt
&);
51 void Leave(const parser::ForallAssignmentStmt
&s
);
52 void Enter(const parser::ExitStmt
&);
53 void Enter(const parser::Expr
&);
54 void Leave(const parser::Expr
&);
55 void Leave(const parser::InquireSpec
&);
56 void Leave(const parser::IoControlSpec
&);
57 void Leave(const parser::OutputImpliedDo
&);
58 void Leave(const parser::StatVariable
&);
61 SemanticsContext
&context_
;
65 StmtType
, const char *enclosingStmt
, const ConstructNode
&) const;
66 void CheckDoConcurrentExit(StmtType
, const ConstructNode
&) const;
67 void CheckForBadLeave(StmtType
, const ConstructNode
&) const;
68 void CheckNesting(StmtType
, const parser::Name
*) const;
70 } // namespace Fortran::semantics