#ifndef FORTRAN_SEMANTICS_CHECK_DO_FORALL_H_
#define FORTRAN_SEMANTICS_CHECK_DO_FORALL_H_
#include "flang/Common/idioms.h"
#include "flang/Semantics/semantics.h"
namespace Fortran::parser {
struct AssignmentStmt;
struct CallStmt;
struct ConnectSpec;
struct CycleStmt;
struct DoConstruct;
struct ExitStmt;
struct Expr;
struct ForallAssignmentStmt;
struct ForallConstruct;
struct ForallStmt;
struct InquireSpec;
struct IoControlSpec;
struct OutputImpliedDo;
struct StatVariable;
}
namespace Fortran::semantics {
ENUM_CLASS(StmtType, CYCLE, EXIT)
class DoForallChecker : public virtual BaseChecker {
public:
explicit DoForallChecker(SemanticsContext &context) : context_{context} {}
void Leave(const parser::AssignmentStmt &);
void Leave(const parser::CallStmt &);
void Leave(const parser::ConnectSpec &);
void Enter(const parser::CycleStmt &);
void Enter(const parser::DoConstruct &);
void Leave(const parser::DoConstruct &);
void Enter(const parser::ForallConstruct &);
void Leave(const parser::ForallConstruct &);
void Enter(const parser::ForallStmt &);
void Leave(const parser::ForallStmt &);
void Leave(const parser::ForallAssignmentStmt &s);
void Enter(const parser::ExitStmt &);
void Enter(const parser::Expr &);
void Leave(const parser::Expr &);
void Leave(const parser::InquireSpec &);
void Leave(const parser::IoControlSpec &);
void Leave(const parser::OutputImpliedDo &);
void Leave(const parser::StatVariable &);
private:
SemanticsContext &context_;
int exprDepth_{0};
void SayBadLeave(
StmtType, const char *enclosingStmt, const ConstructNode &) const;
void CheckDoConcurrentExit(StmtType, const ConstructNode &) const;
void CheckForBadLeave(StmtType, const ConstructNode &) const;
void CheckNesting(StmtType, const parser::Name *) const;
};
}
#endif