1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
//===-- lib/Semantics/check-do-forall.h -------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#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::parser
namespace Fortran::semantics {
// To specify different statement types used in semantic checking.
ENUM_CLASS(StmtType, CYCLE, EXIT)
// Perform semantic checks on DO and FORALL constructs and statements.
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;
};
} // namespace Fortran::semantics
#endif
|