1 // Copyright (c) 2019, NVIDIA CORPORATION.  All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef FORTRAN_SEMANTICS_CHECK_COARRAY_H_
16 #define FORTRAN_SEMANTICS_CHECK_COARRAY_H_
17 
18 #include "semantics.h"
19 #include <list>
20 
21 namespace Fortran::parser {
22 class CharBlock;
23 class MessageFixedText;
24 struct ChangeTeamStmt;
25 struct CoarrayAssociation;
26 struct FormTeamStmt;
27 struct ImageSelectorSpec;
28 struct SyncTeamStmt;
29 struct TeamValue;
30 }
31 
32 namespace Fortran::semantics {
33 
34 class CoarrayChecker : public virtual BaseChecker {
35 public:
CoarrayChecker(SemanticsContext & context)36   CoarrayChecker(SemanticsContext &context) : context_{context} {}
37   void Leave(const parser::ChangeTeamStmt &);
38   void Leave(const parser::SyncTeamStmt &);
39   void Leave(const parser::ImageSelectorSpec &);
40   void Leave(const parser::FormTeamStmt &);
41 
42 private:
43   SemanticsContext &context_;
44 
45   void CheckNamesAreDistinct(const std::list<parser::CoarrayAssociation> &);
46   void Say2(const parser::CharBlock &, parser::MessageFixedText &&,
47       const parser::CharBlock &, parser::MessageFixedText &&);
48 };
49 
50 }
51 #endif  // FORTRAN_SEMANTICS_CHECK_COARRAY_H_
52