[lldb] Add ability to hide the root name of a value
[llvm-project.git] / flang / lib / Semantics / check-do-forall.h
blob3b2ae59f5f3fff388f6cdaf761e8f22bc6fe24ad
1 //===-- lib/Semantics/check-do-forall.h -------------------------*- C++ -*-===//
2 //
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
6 //
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;
17 struct CallStmt;
18 struct ConnectSpec;
19 struct CycleStmt;
20 struct DoConstruct;
21 struct ExitStmt;
22 struct Expr;
23 struct ForallAssignmentStmt;
24 struct ForallConstruct;
25 struct ForallStmt;
26 struct InquireSpec;
27 struct IoControlSpec;
28 struct OutputImpliedDo;
29 struct StatVariable;
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 {
39 public:
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 &);
60 private:
61 SemanticsContext &context_;
62 int exprDepth_{0};
64 void SayBadLeave(
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
71 #endif