1 //===-------lib/Semantics/check-data.h ------------------------------------===//
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_DATA_H_
10 #define FORTRAN_SEMANTICS_CHECK_DATA_H_
11 
12 #include "flang/Parser/parse-tree.h"
13 #include "flang/Parser/tools.h"
14 #include "flang/Semantics/expression.h"
15 #include "flang/Semantics/semantics.h"
16 #include "flang/Semantics/tools.h"
17 
18 namespace Fortran::semantics {
19 class DataChecker : public virtual BaseChecker {
20 public:
21   explicit DataChecker(SemanticsContext &context) : exprAnalyzer_{context} {}
22   void Leave(const parser::DataStmtRepeat &);
23   void Leave(const parser::DataStmtConstant &);
24   void Leave(const parser::DataStmtObject &);
25   void Enter(const parser::DataImpliedDo &);
26   void Leave(const parser::DataImpliedDo &);
27   void Leave(const parser::DataIDoObject &);
28 
29 private:
30   evaluate::ExpressionAnalyzer exprAnalyzer_;
31   template <typename T> void CheckIfConstantSubscript(const T &);
32   void CheckSubscript(const parser::SectionSubscript &);
33   bool CheckAllSubscriptsInDataRef(const parser::DataRef &, parser::CharBlock);
34 };
35 } // namespace Fortran::semantics
36 #endif // FORTRAN_SEMANTICS_CHECK_DATA_H_
37