llvm-project/flang/lib/Semantics/check-coarray.h
Peter Klausler 9f8ff4b77d
[flang] Revamp evaluate::CoarrayRef (#136628)
Bring the typed expression representation of a coindexed reference up to
F'2023, which removed some restrictions that had allowed the current
representation to suffice for older revisions of the language. This new
representation is somewhat more simple -- it uses a DataRef as its base,
so any subscripts in a part-ref can be represented as an ArrayRef there.

Update the code that creates the CoarrayRef, and add more checking to
it, as well as actually capturing any STAT=, TEAM=, & TEAM_NUMBER=
specifiers that might appear. Enforce the constraint that the part-ref
must have subscripts if it is an array. (And update a pile of
copied-and-pasted test code that lacked such subscripts.)
2025-05-12 12:02:15 -07:00

47 lines
1.7 KiB
C++

//===-- lib/Semantics/check-coarray.h ---------------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef FORTRAN_SEMANTICS_CHECK_COARRAY_H_
#define FORTRAN_SEMANTICS_CHECK_COARRAY_H_
#include "flang/Semantics/semantics.h"
#include <list>
namespace Fortran::semantics {
class CoarrayChecker : public virtual BaseChecker {
public:
CoarrayChecker(SemanticsContext &context) : context_{context} {}
void Leave(const parser::ChangeTeamStmt &);
void Leave(const parser::EndChangeTeamStmt &);
void Leave(const parser::SyncAllStmt &);
void Leave(const parser::SyncImagesStmt &);
void Leave(const parser::SyncMemoryStmt &);
void Leave(const parser::SyncTeamStmt &);
void Leave(const parser::NotifyWaitStmt &);
void Leave(const parser::EventPostStmt &);
void Leave(const parser::EventWaitStmt &);
void Leave(const parser::LockStmt &);
void Leave(const parser::UnlockStmt &);
void Leave(const parser::CriticalStmt &);
void Leave(const parser::ImageSelector &);
void Leave(const parser::FormTeamStmt &);
void Enter(const parser::CriticalConstruct &);
void Enter(const parser::ChangeTeamConstruct &);
private:
SemanticsContext &context_;
void CheckNamesAreDistinct(const std::list<parser::CoarrayAssociation> &);
void Say2(const parser::CharBlock &, parser::MessageFixedText &&,
const parser::CharBlock &, parser::MessageFixedText &&);
};
} // namespace Fortran::semantics
#endif // FORTRAN_SEMANTICS_CHECK_COARRAY_H_