[lldb] Add ability to hide the root name of a value
[llvm-project.git] / flang / lib / Semantics / check-acc-structure.h
blobfda626e57ba63655fc2990b5e2e87488137f2e8a
1 //===-- lib/Semantics/check-acc-structure.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 // OpenACC 3.1 structure validity check list
8 // 1. invalid clauses on directive
9 // 2. invalid repeated clauses on directive
10 // 3. invalid nesting of regions
12 //===----------------------------------------------------------------------===//
14 #ifndef FORTRAN_SEMANTICS_CHECK_ACC_STRUCTURE_H_
15 #define FORTRAN_SEMANTICS_CHECK_ACC_STRUCTURE_H_
17 #include "check-directive-structure.h"
18 #include "flang/Common/enum-set.h"
19 #include "flang/Parser/parse-tree.h"
20 #include "flang/Semantics/semantics.h"
21 #include "llvm/Frontend/OpenACC/ACC.h.inc"
23 using AccDirectiveSet = Fortran::common::EnumSet<llvm::acc::Directive,
24 llvm::acc::Directive_enumSize>;
26 using AccClauseSet =
27 Fortran::common::EnumSet<llvm::acc::Clause, llvm::acc::Clause_enumSize>;
29 #define GEN_FLANG_DIRECTIVE_CLAUSE_SETS
30 #include "llvm/Frontend/OpenACC/ACC.inc"
32 namespace Fortran::semantics {
34 class AccStructureChecker
35 : public DirectiveStructureChecker<llvm::acc::Directive, llvm::acc::Clause,
36 parser::AccClause, llvm::acc::Clause_enumSize> {
37 public:
38 AccStructureChecker(SemanticsContext &context)
39 : DirectiveStructureChecker(context,
40 #define GEN_FLANG_DIRECTIVE_CLAUSE_MAP
41 #include "llvm/Frontend/OpenACC/ACC.inc"
42 ) {
45 // Construct and directives
46 void Enter(const parser::OpenACCBlockConstruct &);
47 void Leave(const parser::OpenACCBlockConstruct &);
48 void Enter(const parser::OpenACCCombinedConstruct &);
49 void Leave(const parser::OpenACCCombinedConstruct &);
50 void Enter(const parser::OpenACCLoopConstruct &);
51 void Leave(const parser::OpenACCLoopConstruct &);
52 void Enter(const parser::OpenACCRoutineConstruct &);
53 void Leave(const parser::OpenACCRoutineConstruct &);
54 void Enter(const parser::OpenACCStandaloneConstruct &);
55 void Leave(const parser::OpenACCStandaloneConstruct &);
56 void Enter(const parser::OpenACCStandaloneDeclarativeConstruct &);
57 void Leave(const parser::OpenACCStandaloneDeclarativeConstruct &);
58 void Enter(const parser::OpenACCWaitConstruct &);
59 void Leave(const parser::OpenACCWaitConstruct &);
60 void Enter(const parser::OpenACCAtomicConstruct &);
61 void Leave(const parser::OpenACCAtomicConstruct &);
62 void Enter(const parser::OpenACCCacheConstruct &);
63 void Leave(const parser::OpenACCCacheConstruct &);
65 // Clauses
66 void Leave(const parser::AccClauseList &);
67 void Enter(const parser::AccClause &);
69 #define GEN_FLANG_CLAUSE_CHECK_ENTER
70 #include "llvm/Frontend/OpenACC/ACC.inc"
72 private:
73 bool CheckAllowedModifier(llvm::acc::Clause clause);
74 bool IsComputeConstruct(llvm::acc::Directive directive) const;
75 bool IsInsideComputeConstruct() const;
76 void CheckNotInComputeConstruct();
77 llvm::StringRef getClauseName(llvm::acc::Clause clause) override;
78 llvm::StringRef getDirectiveName(llvm::acc::Directive directive) override;
81 } // namespace Fortran::semantics
83 #endif // FORTRAN_SEMANTICS_CHECK_ACC_STRUCTURE_H_