Objects that are storage associated by EQUIVALENCE and initialized with DATA are initialized by creating a compiler temporary data object in the same scope, assigning it an offset, type, and size that covers the transitive closure of the associated initialized original symbols, and combining their initializers into one common initializer for the temporary. Some problems with offset assignment of EQUIVALENCE'd objects in COMMON were exposed and corrected, and some more error cases are checked. Remove obsolete function. Small bugfix (nested implied dos). Add a test. Fix struct/class warning. Differential Revision: https://reviews.llvm.org/D85560
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
//===-- lib/Semantics/data-to-inits.h -------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef FORTRAN_SEMANTICS_DATA_TO_INITS_H_
|
|
#define FORTRAN_SEMANTICS_DATA_TO_INITS_H_
|
|
|
|
#include "flang/Common/default-kinds.h"
|
|
#include "flang/Common/interval.h"
|
|
#include "flang/Evaluate/initial-image.h"
|
|
#include <list>
|
|
#include <map>
|
|
|
|
namespace Fortran::parser {
|
|
struct DataStmtSet;
|
|
}
|
|
namespace Fortran::evaluate {
|
|
class ExpressionAnalyzer;
|
|
}
|
|
namespace Fortran::semantics {
|
|
|
|
class Symbol;
|
|
|
|
struct SymbolDataInitialization {
|
|
using Range = common::Interval<common::ConstantSubscript>;
|
|
explicit SymbolDataInitialization(std::size_t bytes) : image{bytes} {}
|
|
evaluate::InitialImage image;
|
|
std::list<Range> inits;
|
|
};
|
|
|
|
using DataInitializations = std::map<const Symbol *, SymbolDataInitialization>;
|
|
|
|
// Matches DATA statement variables with their values and checks
|
|
// compatibility.
|
|
void AccumulateDataInitializations(DataInitializations &,
|
|
evaluate::ExpressionAnalyzer &, const parser::DataStmtSet &);
|
|
|
|
void ConvertToInitializers(
|
|
DataInitializations &, evaluate::ExpressionAnalyzer &);
|
|
|
|
} // namespace Fortran::semantics
|
|
#endif // FORTRAN_SEMANTICS_DATA_TO_INITS_H_
|