[lldb] Add ability to hide the root name of a value
[llvm-project.git] / flang / lib / Semantics / check-purity.h
bloba6551162325f9f01db96f722197f7375a8a5f15d
1 //===-- lib/Semantics/check-purity.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 //===----------------------------------------------------------------------===//
9 #ifndef FORTRAN_SEMANTICS_CHECK_PURITY_H_
10 #define FORTRAN_SEMANTICS_CHECK_PURITY_H_
11 #include "flang/Semantics/semantics.h"
12 #include <list>
13 namespace Fortran::parser {
14 struct ExecutableConstruct;
15 struct SubroutineSubprogram;
16 struct FunctionSubprogram;
17 struct PrefixSpec;
18 } // namespace Fortran::parser
19 namespace Fortran::semantics {
20 class PurityChecker : public virtual BaseChecker {
21 public:
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 &);
29 private:
30 bool InPureSubprogram() const;
31 bool HasPurePrefix(const std::list<parser::PrefixSpec> &) const;
32 void Entered(parser::CharBlock, const std::list<parser::PrefixSpec> &);
33 void Left();
34 SemanticsContext &context_;
35 int depth_{0};
36 int pureDepth_{-1};
38 } // namespace Fortran::semantics
39 #endif