2019-12-20 12:52:07 -08:00
|
|
|
//===-- lib/semantics/assignment.h ------------------------------*- C++ -*-===//
|
2018-11-30 14:03:05 -08:00
|
|
|
//
|
2019-12-20 12: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-11-30 14:03:05 -08:00
|
|
|
//
|
2020-01-10 12:12:03 -08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2018-11-30 14:03:05 -08:00
|
|
|
|
|
|
|
#ifndef FORTRAN_SEMANTICS_ASSIGNMENT_H_
|
|
|
|
#define FORTRAN_SEMANTICS_ASSIGNMENT_H_
|
|
|
|
|
2020-01-27 20:57:59 +00:00
|
|
|
#include "flang/common/indirection.h"
|
|
|
|
#include "flang/evaluate/expression.h"
|
|
|
|
#include "flang/semantics/semantics.h"
|
2019-03-05 16:52:50 -08:00
|
|
|
|
2018-11-30 14:03:05 -08:00
|
|
|
namespace Fortran::parser {
|
2020-02-18 17:14:24 -08:00
|
|
|
class ContextualMessages;
|
2018-11-30 14:03:05 -08:00
|
|
|
struct AssignmentStmt;
|
|
|
|
struct PointerAssignmentStmt;
|
|
|
|
struct WhereStmt;
|
2019-03-05 16:52:50 -08:00
|
|
|
struct WhereConstruct;
|
2018-11-30 14:03:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Fortran::semantics {
|
2019-03-05 16:52:50 -08:00
|
|
|
|
2020-01-06 09:16:18 -08:00
|
|
|
class AssignmentContext;
|
2020-02-18 17:14:24 -08:00
|
|
|
class Scope;
|
|
|
|
class Symbol;
|
2019-03-20 11:38:45 -07:00
|
|
|
|
2019-12-23 17:12:53 -08:00
|
|
|
// Applies checks from C1594(1-2) on definitions in pure subprograms
|
2019-12-18 17:06:13 -08:00
|
|
|
void CheckDefinabilityInPureScope(parser::ContextualMessages &, const Symbol &,
|
|
|
|
const Scope &context, const Scope &pure);
|
2019-12-23 17:12:53 -08:00
|
|
|
// Applies checks from C1594(5-6) on copying pointers in pure subprograms
|
2019-11-19 19:10:02 -08:00
|
|
|
void CheckCopyabilityInPureScope(parser::ContextualMessages &,
|
|
|
|
const evaluate::Expr<evaluate::SomeType> &, const Scope &);
|
|
|
|
|
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 &);
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
}
|
2020-01-06 09:16:18 -08:00
|
|
|
|
|
|
|
extern template class Fortran::common::Indirection<
|
|
|
|
Fortran::semantics::AssignmentContext>;
|
2018-11-30 14:03:05 -08:00
|
|
|
#endif // FORTRAN_SEMANTICS_ASSIGNMENT_H_
|