2020-02-25 23:11:52 +08:00
|
|
|
//===-- lib/Semantics/check-data.cpp --------------------------------------===//
|
2020-02-21 14:19:14 +08:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-06-20 00:16:21 +08:00
|
|
|
// DATA statement semantic analysis.
|
|
|
|
// - Applies static semantic checks to the variables in each data-stmt-set with
|
|
|
|
// class DataVarChecker;
|
2020-08-08 04:25:11 +08:00
|
|
|
// - Invokes conversion of DATA statement values to static initializers
|
2020-06-20 00:16:21 +08:00
|
|
|
|
2020-02-21 14:19:14 +08:00
|
|
|
#include "check-data.h"
|
2020-08-08 04:25:11 +08:00
|
|
|
#include "data-to-inits.h"
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
#include "flang/Evaluate/traverse.h"
|
2020-06-20 00:16:21 +08:00
|
|
|
#include "flang/Parser/parse-tree.h"
|
|
|
|
#include "flang/Parser/tools.h"
|
|
|
|
#include "flang/Semantics/tools.h"
|
2020-08-08 04:25:11 +08:00
|
|
|
#include <algorithm>
|
|
|
|
#include <vector>
|
2020-02-21 14:19:14 +08:00
|
|
|
|
|
|
|
namespace Fortran::semantics {
|
|
|
|
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
// Ensures that references to an implied DO loop control variable are
|
|
|
|
// represented as such in the "body" of the implied DO loop.
|
|
|
|
void DataChecker::Enter(const parser::DataImpliedDo &x) {
|
|
|
|
auto name{std::get<parser::DataImpliedDo::Bounds>(x.t).name.thing.thing};
|
|
|
|
int kind{evaluate::ResultType<evaluate::ImpliedDoIndex>::kind};
|
|
|
|
if (const auto dynamicType{evaluate::DynamicType::From(*name.symbol)}) {
|
2020-06-20 00:16:21 +08:00
|
|
|
if (dynamicType->category() == TypeCategory::Integer) {
|
|
|
|
kind = dynamicType->kind();
|
|
|
|
}
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
}
|
|
|
|
exprAnalyzer_.AddImpliedDo(name.source, kind);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataChecker::Leave(const parser::DataImpliedDo &x) {
|
|
|
|
auto name{std::get<parser::DataImpliedDo::Bounds>(x.t).name.thing.thing};
|
|
|
|
exprAnalyzer_.RemoveImpliedDo(name.source);
|
|
|
|
}
|
|
|
|
|
2020-06-20 00:16:21 +08:00
|
|
|
// DataVarChecker applies static checks once to each variable that appears
|
|
|
|
// in a data-stmt-set. These checks are independent of the values that
|
|
|
|
// correspond to the variables.
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
class DataVarChecker : public evaluate::AllTraverse<DataVarChecker, true> {
|
|
|
|
public:
|
|
|
|
using Base = evaluate::AllTraverse<DataVarChecker, true>;
|
|
|
|
DataVarChecker(SemanticsContext &c, parser::CharBlock src)
|
|
|
|
: Base{*this}, context_{c}, source_{src} {}
|
|
|
|
using Base::operator();
|
|
|
|
bool HasComponentWithoutSubscripts() const {
|
|
|
|
return hasComponent_ && !hasSubscript_;
|
|
|
|
}
|
2020-06-20 00:16:21 +08:00
|
|
|
bool operator()(const Symbol &symbol) { // C876
|
|
|
|
// 8.6.7p(2) - precludes non-pointers of derived types with
|
|
|
|
// default component values
|
|
|
|
const Scope &scope{context_.FindScope(source_)};
|
|
|
|
bool isFirstSymbol{isFirstSymbol_};
|
|
|
|
isFirstSymbol_ = false;
|
2020-07-02 07:51:44 +08:00
|
|
|
if (const char *whyNot{IsAutomatic(symbol) ? "Automatic variable"
|
|
|
|
: IsDummy(symbol) ? "Dummy argument"
|
|
|
|
: IsFunctionResult(symbol) ? "Function result"
|
|
|
|
: IsAllocatable(symbol) ? "Allocatable"
|
|
|
|
: IsInitialized(symbol, true) ? "Default-initialized"
|
|
|
|
: IsInBlankCommon(symbol) ? "Blank COMMON object"
|
|
|
|
: IsProcedure(symbol) && !IsPointer(symbol) ? "Procedure"
|
|
|
|
// remaining checks don't apply to components
|
2021-04-01 00:12:28 +08:00
|
|
|
: !isFirstSymbol ? nullptr
|
|
|
|
: IsHostAssociated(symbol, scope) ? "Host-associated object"
|
|
|
|
: IsUseAssociated(symbol, scope) ? "USE-associated object"
|
|
|
|
: symbol.has<AssocEntityDetails>() ? "Construct association"
|
2021-09-15 04:37:11 +08:00
|
|
|
: IsPointer(symbol) && (hasComponent_ || hasSubscript_)
|
|
|
|
? "Target of pointer"
|
|
|
|
: nullptr}) {
|
2020-06-20 00:16:21 +08:00
|
|
|
context_.Say(source_,
|
|
|
|
"%s '%s' must not be initialized in a DATA statement"_err_en_US,
|
|
|
|
whyNot, symbol.name());
|
|
|
|
return false;
|
|
|
|
} else if (IsProcedurePointer(symbol)) {
|
|
|
|
context_.Say(source_,
|
|
|
|
"Procedure pointer '%s' in a DATA statement is not standard"_en_US,
|
|
|
|
symbol.name());
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
bool operator()(const evaluate::Component &component) {
|
|
|
|
hasComponent_ = true;
|
2020-06-03 12:56:10 +08:00
|
|
|
const Symbol &lastSymbol{component.GetLastSymbol()};
|
|
|
|
if (isPointerAllowed_) {
|
|
|
|
if (IsPointer(lastSymbol) && hasSubscript_) { // C877
|
|
|
|
context_.Say(source_,
|
|
|
|
"Rightmost data object pointer '%s' must not be subscripted"_err_en_US,
|
|
|
|
lastSymbol.name().ToString());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
RestrictPointer();
|
|
|
|
} else {
|
|
|
|
if (IsPointer(lastSymbol)) { // C877
|
|
|
|
context_.Say(source_,
|
|
|
|
"Data object must not contain pointer '%s' as a non-rightmost part"_err_en_US,
|
|
|
|
lastSymbol.name().ToString());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (*this)(component.base()) && (*this)(lastSymbol);
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
}
|
2020-06-03 12:56:10 +08:00
|
|
|
bool operator()(const evaluate::ArrayRef &arrayRef) {
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
hasSubscript_ = true;
|
2020-06-03 12:56:10 +08:00
|
|
|
return (*this)(arrayRef.base()) && (*this)(arrayRef.subscript());
|
|
|
|
}
|
|
|
|
bool operator()(const evaluate::Substring &substring) {
|
|
|
|
hasSubscript_ = true;
|
|
|
|
return (*this)(substring.parent()) && (*this)(substring.lower()) &&
|
|
|
|
(*this)(substring.upper());
|
|
|
|
}
|
|
|
|
bool operator()(const evaluate::CoarrayRef &) { // C874
|
|
|
|
context_.Say(
|
|
|
|
source_, "Data object must not be a coindexed variable"_err_en_US);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool operator()(const evaluate::Subscript &subs) {
|
|
|
|
DataVarChecker subscriptChecker{context_, source_};
|
|
|
|
subscriptChecker.RestrictPointer();
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
return std::visit(
|
2020-06-03 12:56:10 +08:00
|
|
|
common::visitors{
|
|
|
|
[&](const evaluate::IndirectSubscriptIntegerExpr &expr) {
|
|
|
|
return CheckSubscriptExpr(expr);
|
|
|
|
},
|
|
|
|
[&](const evaluate::Triplet &triplet) {
|
|
|
|
return CheckSubscriptExpr(triplet.lower()) &&
|
|
|
|
CheckSubscriptExpr(triplet.upper()) &&
|
|
|
|
CheckSubscriptExpr(triplet.stride());
|
|
|
|
},
|
|
|
|
},
|
|
|
|
subs.u) &&
|
|
|
|
subscriptChecker(subs.u);
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
}
|
|
|
|
template <typename T>
|
|
|
|
bool operator()(const evaluate::FunctionRef<T> &) const { // C875
|
|
|
|
context_.Say(source_,
|
|
|
|
"Data object variable must not be a function reference"_err_en_US);
|
|
|
|
return false;
|
|
|
|
}
|
2020-06-03 12:56:10 +08:00
|
|
|
void RestrictPointer() { isPointerAllowed_ = false; }
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool CheckSubscriptExpr(
|
|
|
|
const std::optional<evaluate::IndirectSubscriptIntegerExpr> &x) const {
|
|
|
|
return !x || CheckSubscriptExpr(*x);
|
|
|
|
}
|
|
|
|
bool CheckSubscriptExpr(
|
|
|
|
const evaluate::IndirectSubscriptIntegerExpr &expr) const {
|
|
|
|
return CheckSubscriptExpr(expr.value());
|
|
|
|
}
|
|
|
|
bool CheckSubscriptExpr(
|
|
|
|
const evaluate::Expr<evaluate::SubscriptInteger> &expr) const {
|
|
|
|
if (!evaluate::IsConstantExpr(expr)) { // C875,C881
|
|
|
|
context_.Say(
|
|
|
|
source_, "Data object must have constant subscripts"_err_en_US);
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SemanticsContext &context_;
|
|
|
|
parser::CharBlock source_;
|
|
|
|
bool hasComponent_{false};
|
|
|
|
bool hasSubscript_{false};
|
2020-06-03 12:56:10 +08:00
|
|
|
bool isPointerAllowed_{true};
|
2020-06-20 00:16:21 +08:00
|
|
|
bool isFirstSymbol_{true};
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void DataChecker::Leave(const parser::DataIDoObject &object) {
|
|
|
|
if (const auto *designator{
|
|
|
|
std::get_if<parser::Scalar<common::Indirection<parser::Designator>>>(
|
|
|
|
&object.u)}) {
|
|
|
|
if (MaybeExpr expr{exprAnalyzer_.Analyze(*designator)}) {
|
|
|
|
auto source{designator->thing.value().source};
|
2020-06-03 12:56:10 +08:00
|
|
|
if (evaluate::IsConstantExpr(*expr)) { // C878,C879
|
2020-06-20 00:16:21 +08:00
|
|
|
exprAnalyzer_.context().Say(
|
Rework DATA statement semantics to use typed expressions
Summary:
Updates recent work on DATA statement semantic checking in
flang/lib/Semantics/check-data.{h,cpp} to use the compiler's
internal representation for typed expressions rather than working
on the raw parse tree. Saves the analyzed expressions for DATA
statement values as parse tree decorations because they'll soon be
needed in lowering. Corrects wording of some error messages.
Fixes a bug in constant expression checking: structure constructors
are not constant expressions if they set an allocatable component
to anything other than NULL.
Includes infrastructure changes to make this work, some renaming
to reflect the fact that the implied DO loop indices tracked by
expression analysis are not (just) from array constructors, remove
some dead code, and improve some comments.
Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby, anchu-rajendran, schweitz
Reviewed By: tskeith, anchu-rajendran, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D78834
2020-04-25 04:54:11 +08:00
|
|
|
source, "Data implied do object must be a variable"_err_en_US);
|
|
|
|
} else {
|
|
|
|
DataVarChecker checker{exprAnalyzer_.context(), source};
|
2020-06-20 00:16:21 +08:00
|
|
|
if (checker(*expr)) {
|
|
|
|
if (checker.HasComponentWithoutSubscripts()) { // C880
|
|
|
|
exprAnalyzer_.context().Say(source,
|
|
|
|
"Data implied do structure component must be subscripted"_err_en_US);
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
2020-04-18 14:09:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-08 04:25:11 +08:00
|
|
|
currentSetHasFatalErrors_ = true;
|
2020-04-18 14:09:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataChecker::Leave(const parser::DataStmtObject &dataObject) {
|
2020-06-20 00:16:21 +08:00
|
|
|
std::visit(common::visitors{
|
|
|
|
[](const parser::DataImpliedDo &) { // has own Enter()/Leave()
|
|
|
|
},
|
|
|
|
[&](const auto &var) {
|
|
|
|
auto expr{exprAnalyzer_.Analyze(var)};
|
|
|
|
if (!expr ||
|
|
|
|
!DataVarChecker{exprAnalyzer_.context(),
|
|
|
|
parser::FindSourceLocation(dataObject)}(*expr)) {
|
|
|
|
currentSetHasFatalErrors_ = true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
dataObject.u);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataChecker::Leave(const parser::DataStmtSet &set) {
|
|
|
|
if (!currentSetHasFatalErrors_) {
|
2020-08-08 04:25:11 +08:00
|
|
|
AccumulateDataInitializations(inits_, exprAnalyzer_, set);
|
2020-06-20 00:16:21 +08:00
|
|
|
}
|
|
|
|
currentSetHasFatalErrors_ = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataChecker::CompileDataInitializationsIntoInitializers() {
|
2020-08-08 04:25:11 +08:00
|
|
|
ConvertToInitializers(inits_, exprAnalyzer_);
|
2020-06-20 00:16:21 +08:00
|
|
|
}
|
|
|
|
|
2020-03-29 12:00:16 +08:00
|
|
|
} // namespace Fortran::semantics
|