CarolineConcatto | 64ab330 | 2020-02-25 15:11:52 | [diff] [blame] | 1 | //===-- lib/Semantics/assignment.h ------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef FORTRAN_SEMANTICS_ASSIGNMENT_H_ |
| 10 | #define FORTRAN_SEMANTICS_ASSIGNMENT_H_ |
| 11 | |
| 12 | #include "flang/Common/indirection.h" |
| 13 | #include "flang/Evaluate/expression.h" |
| 14 | #include "flang/Semantics/semantics.h" |
| 15 | |
| 16 | namespace Fortran::parser { |
| 17 | class ContextualMessages; |
| 18 | struct AssignmentStmt; |
| 19 | struct EndWhereStmt; |
| 20 | struct MaskedElsewhereStmt; |
| 21 | struct PointerAssignmentStmt; |
| 22 | struct WhereConstructStmt; |
| 23 | struct WhereStmt; |
Tim Keith | 1f87900 | 2020-03-29 04:00:16 | [diff] [blame] | 24 | } // namespace Fortran::parser |
CarolineConcatto | 64ab330 | 2020-02-25 15:11:52 | [diff] [blame] | 25 | |
| 26 | namespace Fortran::semantics { |
| 27 | |
| 28 | class AssignmentContext; |
| 29 | class Scope; |
| 30 | class Symbol; |
| 31 | |
| 32 | // Applies checks from C1594(1-2) on definitions in pure subprograms |
Tim Keith | c97e1c0 | 2020-03-05 21:05:45 | [diff] [blame] | 33 | bool CheckDefinabilityInPureScope(parser::ContextualMessages &, const Symbol &, |
CarolineConcatto | 64ab330 | 2020-02-25 15:11:52 | [diff] [blame] | 34 | const Scope &context, const Scope &pure); |
| 35 | // Applies checks from C1594(5-6) on copying pointers in pure subprograms |
Tim Keith | c97e1c0 | 2020-03-05 21:05:45 | [diff] [blame] | 36 | bool CheckCopyabilityInPureScope(parser::ContextualMessages &, |
CarolineConcatto | 64ab330 | 2020-02-25 15:11:52 | [diff] [blame] | 37 | const evaluate::Expr<evaluate::SomeType> &, const Scope &); |
| 38 | |
| 39 | class AssignmentChecker : public virtual BaseChecker { |
| 40 | public: |
| 41 | explicit AssignmentChecker(SemanticsContext &); |
| 42 | ~AssignmentChecker(); |
| 43 | void Enter(const parser::AssignmentStmt &); |
| 44 | void Enter(const parser::PointerAssignmentStmt &); |
| 45 | void Enter(const parser::WhereStmt &); |
| 46 | void Leave(const parser::WhereStmt &); |
| 47 | void Enter(const parser::WhereConstructStmt &); |
| 48 | void Leave(const parser::EndWhereStmt &); |
| 49 | void Enter(const parser::MaskedElsewhereStmt &); |
| 50 | void Leave(const parser::MaskedElsewhereStmt &); |
| 51 | |
| 52 | private: |
| 53 | common::Indirection<AssignmentContext> context_; |
| 54 | }; |
| 55 | |
Tim Keith | 1f87900 | 2020-03-29 04:00:16 | [diff] [blame] | 56 | } // namespace Fortran::semantics |
CarolineConcatto | 64ab330 | 2020-02-25 15:11:52 | [diff] [blame] | 57 | |
| 58 | extern template class Fortran::common::Indirection< |
| 59 | Fortran::semantics::AssignmentContext>; |
Tim Keith | 1f87900 | 2020-03-29 04:00:16 | [diff] [blame] | 60 | #endif // FORTRAN_SEMANTICS_ASSIGNMENT_H_ |