2020-02-25 23:11:52 +08:00
|
|
|
//===-- lib/Semantics/assignment.h ------------------------------*- C++ -*-===//
|
2018-12-01 06:03:05 +08:00
|
|
|
//
|
2019-12-21 04:52:07 +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
|
2018-12-01 06:03:05 +08:00
|
|
|
//
|
2020-01-11 04:12:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2018-12-01 06:03:05 +08:00
|
|
|
|
|
|
|
#ifndef FORTRAN_SEMANTICS_ASSIGNMENT_H_
|
|
|
|
#define FORTRAN_SEMANTICS_ASSIGNMENT_H_
|
|
|
|
|
2020-02-25 23:11:52 +08:00
|
|
|
#include "flang/Common/indirection.h"
|
|
|
|
#include "flang/Evaluate/expression.h"
|
|
|
|
#include "flang/Semantics/semantics.h"
|
2019-03-06 08:52:50 +08:00
|
|
|
|
2018-12-01 06:03:05 +08:00
|
|
|
namespace Fortran::parser {
|
2020-02-19 09:14:24 +08:00
|
|
|
class ContextualMessages;
|
2018-12-01 06:03:05 +08:00
|
|
|
struct AssignmentStmt;
|
2020-02-21 06:54:46 +08:00
|
|
|
struct EndWhereStmt;
|
|
|
|
struct MaskedElsewhereStmt;
|
2018-12-01 06:03:05 +08:00
|
|
|
struct PointerAssignmentStmt;
|
2020-02-21 06:54:46 +08:00
|
|
|
struct WhereConstructStmt;
|
2018-12-01 06:03:05 +08:00
|
|
|
struct WhereStmt;
|
2020-03-29 12:00:16 +08:00
|
|
|
} // namespace Fortran::parser
|
2018-12-01 06:03:05 +08:00
|
|
|
|
|
|
|
namespace Fortran::semantics {
|
2019-03-06 08:52:50 +08:00
|
|
|
|
2020-01-07 01:16:18 +08:00
|
|
|
class AssignmentContext;
|
2020-02-19 09:14:24 +08:00
|
|
|
class Scope;
|
|
|
|
class Symbol;
|
2019-03-21 02:38:45 +08:00
|
|
|
|
2019-12-24 09:12:53 +08:00
|
|
|
// Applies checks from C1594(1-2) on definitions in pure subprograms
|
2020-03-06 05:05:45 +08:00
|
|
|
bool CheckDefinabilityInPureScope(parser::ContextualMessages &, const Symbol &,
|
2019-12-19 09:06:13 +08:00
|
|
|
const Scope &context, const Scope &pure);
|
2019-12-24 09:12:53 +08:00
|
|
|
// Applies checks from C1594(5-6) on copying pointers in pure subprograms
|
2020-03-06 05:05:45 +08:00
|
|
|
bool CheckCopyabilityInPureScope(parser::ContextualMessages &,
|
2019-11-20 11:10:02 +08:00
|
|
|
const evaluate::Expr<evaluate::SomeType> &, const Scope &);
|
|
|
|
|
2019-03-06 08:52:50 +08:00
|
|
|
class AssignmentChecker : public virtual BaseChecker {
|
|
|
|
public:
|
|
|
|
explicit AssignmentChecker(SemanticsContext &);
|
2019-03-21 02:38:45 +08:00
|
|
|
~AssignmentChecker();
|
2019-03-06 08:52:50 +08:00
|
|
|
void Enter(const parser::AssignmentStmt &);
|
|
|
|
void Enter(const parser::PointerAssignmentStmt &);
|
|
|
|
void Enter(const parser::WhereStmt &);
|
2020-02-21 06:54:46 +08:00
|
|
|
void Leave(const parser::WhereStmt &);
|
|
|
|
void Enter(const parser::WhereConstructStmt &);
|
|
|
|
void Leave(const parser::EndWhereStmt &);
|
|
|
|
void Enter(const parser::MaskedElsewhereStmt &);
|
|
|
|
void Leave(const parser::MaskedElsewhereStmt &);
|
2019-03-06 08:52:50 +08:00
|
|
|
|
|
|
|
private:
|
2019-03-21 02:38:45 +08:00
|
|
|
common::Indirection<AssignmentContext> context_;
|
2019-03-06 08:52:50 +08:00
|
|
|
};
|
2018-12-01 06:03:05 +08:00
|
|
|
|
2020-03-29 12:00:16 +08:00
|
|
|
} // namespace Fortran::semantics
|
2020-01-07 01:16:18 +08:00
|
|
|
|
|
|
|
extern template class Fortran::common::Indirection<
|
|
|
|
Fortran::semantics::AssignmentContext>;
|
2020-03-29 12:00:16 +08:00
|
|
|
#endif // FORTRAN_SEMANTICS_ASSIGNMENT_H_
|