173
|
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
|
221
|
12 #include "data-to-inits.h"
|
|
13 #include "flang/Common/interval.h"
|
|
14 #include "flang/Evaluate/fold-designator.h"
|
|
15 #include "flang/Evaluate/initial-image.h"
|
173
|
16 #include "flang/Semantics/expression.h"
|
|
17 #include "flang/Semantics/semantics.h"
|
221
|
18 #include <list>
|
|
19 #include <map>
|
|
20 #include <vector>
|
|
21
|
|
22 namespace Fortran::parser {
|
|
23 struct DataStmtRepeat;
|
|
24 struct DataStmtObject;
|
|
25 struct DataIDoObject;
|
|
26 class DataStmtImpliedDo;
|
|
27 struct DataStmtSet;
|
|
28 } // namespace Fortran::parser
|
173
|
29
|
|
30 namespace Fortran::semantics {
|
221
|
31
|
173
|
32 class DataChecker : public virtual BaseChecker {
|
|
33 public:
|
|
34 explicit DataChecker(SemanticsContext &context) : exprAnalyzer_{context} {}
|
|
35 void Leave(const parser::DataStmtObject &);
|
221
|
36 void Leave(const parser::DataIDoObject &);
|
173
|
37 void Enter(const parser::DataImpliedDo &);
|
|
38 void Leave(const parser::DataImpliedDo &);
|
221
|
39 void Leave(const parser::DataStmtSet &);
|
236
|
40 // These cases are for legacy DATA-like /initializations/
|
|
41 void Leave(const parser::ComponentDecl &);
|
|
42 void Leave(const parser::EntityDecl &);
|
221
|
43
|
|
44 // After all DATA statements have been processed, converts their
|
|
45 // initializations into per-symbol static initializers.
|
|
46 void CompileDataInitializationsIntoInitializers();
|
173
|
47
|
|
48 private:
|
221
|
49 ConstantSubscript GetRepetitionCount(const parser::DataStmtRepeat &);
|
173
|
50 template <typename T> void CheckIfConstantSubscript(const T &);
|
|
51 void CheckSubscript(const parser::SectionSubscript &);
|
|
52 bool CheckAllSubscriptsInDataRef(const parser::DataRef &, parser::CharBlock);
|
236
|
53 template <typename A> void LegacyDataInit(const A &);
|
221
|
54
|
|
55 DataInitializations inits_;
|
|
56 evaluate::ExpressionAnalyzer exprAnalyzer_;
|
|
57 bool currentSetHasFatalErrors_{false};
|
173
|
58 };
|
|
59 } // namespace Fortran::semantics
|
|
60 #endif // FORTRAN_SEMANTICS_CHECK_DATA_H_
|