1 //===-- lib/Semantics/check-purity.h ----------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef FORTRAN_SEMANTICS_CHECK_PURITY_H_
10 #define FORTRAN_SEMANTICS_CHECK_PURITY_H_
11 #include "flang/Semantics/semantics.h"
13 namespace Fortran::parser
{
14 struct ExecutableConstruct
;
15 struct SubroutineSubprogram
;
16 struct FunctionSubprogram
;
18 } // namespace Fortran::parser
19 namespace Fortran::semantics
{
20 class PurityChecker
: public virtual BaseChecker
{
22 explicit PurityChecker(SemanticsContext
&c
) : context_
{c
} {}
23 void Enter(const parser::ExecutableConstruct
&);
24 void Enter(const parser::SubroutineSubprogram
&);
25 void Leave(const parser::SubroutineSubprogram
&);
26 void Enter(const parser::FunctionSubprogram
&);
27 void Leave(const parser::FunctionSubprogram
&);
30 bool InPureSubprogram() const;
31 bool HasPurePrefix(const std::list
<parser::PrefixSpec
> &) const;
32 void Entered(parser::CharBlock
, const std::list
<parser::PrefixSpec
> &);
34 SemanticsContext
&context_
;
38 } // namespace Fortran::semantics