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 CriticalStmt; 20 struct CoarrayAssociation; 21 struct EndChangeTeamStmt; 22 struct EventPostStmt; 23 struct EventWaitStmt; 24 struct FormTeamStmt; 25 struct ImageSelector; 26 struct NotifyWaitStmt; 27 struct SyncAllStmt; 28 struct SyncImagesStmt; 29 struct SyncMemoryStmt; 30 struct SyncTeamStmt; 31 struct UnlockStmt; 32 } // namespace Fortran::parser 33 34 namespace Fortran::semantics { 35 36 class CoarrayChecker : public virtual BaseChecker { 37 public: CoarrayChecker(SemanticsContext & context)38 CoarrayChecker(SemanticsContext &context) : context_{context} {} 39 void Leave(const parser::ChangeTeamStmt &); 40 void Leave(const parser::EndChangeTeamStmt &); 41 void Leave(const parser::SyncAllStmt &); 42 void Leave(const parser::SyncImagesStmt &); 43 void Leave(const parser::SyncMemoryStmt &); 44 void Leave(const parser::SyncTeamStmt &); 45 void Leave(const parser::NotifyWaitStmt &); 46 void Leave(const parser::EventPostStmt &); 47 void Leave(const parser::EventWaitStmt &); 48 void Leave(const parser::UnlockStmt &); 49 void Leave(const parser::CriticalStmt &); 50 void Leave(const parser::ImageSelector &); 51 void Leave(const parser::FormTeamStmt &); 52 53 void Enter(const parser::CriticalConstruct &); 54 55 private: 56 SemanticsContext &context_; 57 bool haveStat_; 58 bool haveTeam_; 59 bool haveTeamNumber_; 60 61 void CheckNamesAreDistinct(const std::list<parser::CoarrayAssociation> &); 62 void Say2(const parser::CharBlock &, parser::MessageFixedText &&, 63 const parser::CharBlock &, parser::MessageFixedText &&); 64 }; 65 } // namespace Fortran::semantics 66 #endif // FORTRAN_SEMANTICS_CHECK_COARRAY_H_ 67