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

source code of flang/lib/Semantics/check-data.h