1 //===-- lib/Semantics/check-coarray.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 //===----------------------------------------------------------------------===//
8 
9 #ifndef FORTRAN_SEMANTICS_CHECK_COARRAY_H_
10 #define FORTRAN_SEMANTICS_CHECK_COARRAY_H_
11 
12 #include "flang/Semantics/semantics.h"
13 #include <list>
14 
15 namespace Fortran::parser {
16 class CharBlock;
17 class MessageFixedText;
18 struct ChangeTeamStmt;
19 struct CoarrayAssociation;
20 struct FormTeamStmt;
21 struct ImageSelector;
22 struct SyncTeamStmt;
23 } // namespace Fortran::parser
24 
25 namespace Fortran::semantics {
26 
27 class CoarrayChecker : public virtual BaseChecker {
28 public:
CoarrayChecker(SemanticsContext & context)29   CoarrayChecker(SemanticsContext &context) : context_{context} {}
30   void Leave(const parser::ChangeTeamStmt &);
31   void Leave(const parser::SyncTeamStmt &);
32   void Leave(const parser::ImageSelector &);
33   void Leave(const parser::FormTeamStmt &);
34 
35   void Enter(const parser::CriticalConstruct &);
36 
37 private:
38   SemanticsContext &context_;
39   bool haveStat_;
40   bool haveTeam_;
41   bool haveTeamNumber_;
42 
43   void CheckNamesAreDistinct(const std::list<parser::CoarrayAssociation> &);
44   void Say2(const parser::CharBlock &, parser::MessageFixedText &&,
45       const parser::CharBlock &, parser::MessageFixedText &&);
46 };
47 } // namespace Fortran::semantics
48 #endif // FORTRAN_SEMANTICS_CHECK_COARRAY_H_
49