2018-12-04 10:55:32 -08:00
|
|
|
// Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
2018-11-30 14:03:05 -08:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
#ifndef FORTRAN_SEMANTICS_ASSIGNMENT_H_
|
|
|
|
#define FORTRAN_SEMANTICS_ASSIGNMENT_H_
|
|
|
|
|
2019-03-05 16:52:50 -08:00
|
|
|
#include "semantics.h"
|
|
|
|
#include "../common/indirection.h"
|
2019-03-20 11:38:45 -07:00
|
|
|
#include "../evaluate/expression.h"
|
2019-03-05 16:52:50 -08:00
|
|
|
|
2018-11-30 14:03:05 -08:00
|
|
|
namespace Fortran::parser {
|
|
|
|
template<typename> struct Statement;
|
|
|
|
struct AssignmentStmt;
|
2018-12-04 10:55:32 -08:00
|
|
|
struct ConcurrentHeader;
|
2018-11-30 14:03:05 -08:00
|
|
|
struct ForallStmt;
|
|
|
|
struct PointerAssignmentStmt;
|
|
|
|
struct Program;
|
|
|
|
struct WhereStmt;
|
2019-03-05 16:52:50 -08:00
|
|
|
struct WhereConstruct;
|
|
|
|
struct ForallStmt;
|
|
|
|
struct ForallConstruct;
|
2018-11-30 14:03:05 -08:00
|
|
|
}
|
|
|
|
|
2019-03-20 11:38:45 -07:00
|
|
|
namespace Fortran::evaluate {
|
2019-03-11 15:39:11 -07:00
|
|
|
class IntrinsicProcTable;
|
|
|
|
void CheckPointerAssignment(parser::ContextualMessages &,
|
|
|
|
const IntrinsicProcTable &, const Symbol &lhs,
|
|
|
|
const evaluate::Expr<evaluate::SomeType> &rhs);
|
2019-03-20 11:38:45 -07:00
|
|
|
}
|
|
|
|
|
2018-11-30 14:03:05 -08:00
|
|
|
namespace Fortran::semantics {
|
2019-03-05 16:52:50 -08:00
|
|
|
class AssignmentContext;
|
2019-03-20 11:38:45 -07:00
|
|
|
}
|
2019-03-05 16:52:50 -08:00
|
|
|
|
2019-03-20 11:38:45 -07:00
|
|
|
extern template class Fortran::common::Indirection<
|
|
|
|
Fortran::semantics::AssignmentContext>;
|
|
|
|
|
|
|
|
namespace Fortran::semantics {
|
2019-03-05 16:52:50 -08:00
|
|
|
class AssignmentChecker : public virtual BaseChecker {
|
|
|
|
public:
|
|
|
|
explicit AssignmentChecker(SemanticsContext &);
|
2019-03-20 11:38:45 -07:00
|
|
|
~AssignmentChecker();
|
2019-03-05 16:52:50 -08:00
|
|
|
void Enter(const parser::AssignmentStmt &);
|
|
|
|
void Enter(const parser::PointerAssignmentStmt &);
|
|
|
|
void Enter(const parser::WhereStmt &);
|
|
|
|
void Enter(const parser::WhereConstruct &);
|
|
|
|
void Enter(const parser::ForallStmt &);
|
|
|
|
void Enter(const parser::ForallConstruct &);
|
|
|
|
|
|
|
|
private:
|
2019-03-20 11:38:45 -07:00
|
|
|
common::Indirection<AssignmentContext> context_;
|
2019-03-05 16:52:50 -08:00
|
|
|
};
|
2018-11-30 14:03:05 -08:00
|
|
|
|
|
|
|
// Semantic analysis of an assignment statement or WHERE/FORALL construct.
|
|
|
|
void AnalyzeAssignment(
|
|
|
|
SemanticsContext &, const parser::Statement<parser::AssignmentStmt> &);
|
|
|
|
void AnalyzeAssignment(SemanticsContext &,
|
|
|
|
const parser::Statement<parser::PointerAssignmentStmt> &);
|
|
|
|
void AnalyzeAssignment(
|
|
|
|
SemanticsContext &, const parser::Statement<parser::WhereStmt> &);
|
|
|
|
void AnalyzeAssignment(
|
|
|
|
SemanticsContext &, const parser::Statement<parser::ForallStmt> &);
|
|
|
|
|
2018-12-04 10:55:32 -08:00
|
|
|
// R1125 concurrent-header is used in FORALL statements & constructs as
|
|
|
|
// well as in DO CONCURRENT loops.
|
|
|
|
void AnalyzeConcurrentHeader(
|
|
|
|
SemanticsContext &, const parser::ConcurrentHeader &);
|
2018-11-30 14:03:05 -08:00
|
|
|
}
|
|
|
|
#endif // FORTRAN_SEMANTICS_ASSIGNMENT_H_
|