66class OmpStructureChecker :
public OmpStructureCheckerBase {
68 using Base = OmpStructureCheckerBase;
82 void Enter(
const parser::EndSubroutineStmt &);
84 void Enter(
const parser::EndFunctionStmt &);
85 void Enter(
const parser::MpSubprogramStmt &);
86 void Enter(
const parser::EndMpSubprogramStmt &);
94 void Enter(
const parser::ExecutionPart &);
95 void Leave(
const parser::ExecutionPart &);
184 void Enter(
const parser::OmpContextSelector &);
185 void Leave(
const parser::OmpContextSelector &);
188 void Leave(
const parser::GotoStmt &);
192 void Leave(
const parser::AltReturnSpec &);
193 void Leave(
const parser::ErrLabel &);
194 void Leave(
const parser::EndLabel &);
195 void Leave(
const parser::EorLabel &);
197#define GEN_FLANG_CLAUSE_CHECK_ENTER
198#include "llvm/Frontend/OpenMP/OMP.inc"
212 std::string_view name,
bool checkTypeOnPointer =
true);
221 void CheckAtomicReadAssignment(
223 void CheckAtomicWriteAssignment(
225 std::optional<evaluate::Assignment> CheckAtomicUpdateAssignment(
227 std::pair<bool, bool> CheckAtomicUpdateAssignmentRhs(
const SomeExpr &atom,
229 void CheckAtomicConditionalUpdateAssignment(
const SomeExpr &cond,
232 void CheckAtomicConditionalUpdateStmt(
240 void CheckAtomicConditionalUpdateCapture(
258 void CheckScanModifier(
const parser::OmpClause::Reduction &x);
262 void CheckOmpDeclareVariantDirective(
264 void CheckDeclareVariantUserConditions(
const parser::OmpContextSelector &);
265 const std::list<parser::OmpTraitProperty> &GetTraitPropertyList(
267 std::optional<llvm::omp::Clause> GetClauseFromProperty(
270 void CheckTraitSelectorList(
const std::list<parser::OmpTraitSelector> &);
271 void CheckContextSelectorSpecification(
const parser::OmpContextSelector &);
274 bool VerifyTraitPropertyLists(
276 void CheckTraitSelector(
280 void CheckTraitCondition(
282 void CheckTraitDeviceNum(
284 void CheckTraitRequires(
290 bool IsAllowedClause(llvm::omp::Clause clauseId);
291 bool CheckAllowedClause(llvm::omp::Clause clause);
293 void CheckDirectiveSpelling(
299 void CheckSourceLabel(
const parser::Label &);
303 void CheckMultipleOccurrence(semantics::UnorderedSymbolSet &listVars,
305 const std::string &clauseName);
306 void CheckMultListItems();
307 void CheckStructureComponent(
309 void CheckStructureComponent(
311 bool HasInvalidWorksharingNesting(
314 bool IsCloselyNestedRegion(
const OmpDirectiveSet &set);
315 bool IsNestedInDirective(llvm::omp::Directive directive);
316 bool IsCombinedParallelWorksharing(llvm::omp::Directive directive)
const;
317 bool InTargetRegion();
318 void HasInvalidTeamsNesting(
320 bool HasRequires(llvm::omp::Clause req);
321 void CheckAllowedMapTypes(
324 llvm::StringRef getClauseName(llvm::omp::Clause clause)
override;
325 llvm::StringRef getDirectiveName(llvm::omp::Directive directive)
override;
328 typename LessTy,
typename RangeTy,
329 typename IterTy =
decltype(std::declval<RangeTy>().begin())>
330 std::optional<IterTy> FindDuplicate(RangeTy &&);
345 void CheckThreadprivateOrDeclareTargetVar(
const parser::Name &);
348 void CheckIntentInPointer(SymbolSourceMap &,
const llvm::omp::Clause);
349 void CheckProcedurePointer(SymbolSourceMap &,
const llvm::omp::Clause);
351 llvm::StringRef clause,
bool suggestToUseCrayPointer =
true);
353 void CheckDefinableObjects(SymbolSourceMap &,
const llvm::omp::Clause);
354 void CheckCopyingPolymorphicAllocatable(
355 SymbolSourceMap &,
const llvm::omp::Clause);
356 void CheckPrivateSymbolsInOuterCxt(
357 SymbolSourceMap &, DirectivesClauseTriple &,
const llvm::omp::Clause);
358 bool CheckTargetBlockOnlyTeams(
const parser::Block &);
361 void CheckIndividualAllocateDirective(
369 void CheckTargetUpdate();
371 void CheckDependenceType(
const parser::OmpDependenceType::Value &x);
372 void CheckTaskDependenceType(
const parser::OmpTaskDependenceType::Value &x);
373 std::optional<llvm::omp::Directive> GetCancelType(
375 const std::optional<parser::OmpClauseList> &maybeClauses);
376 void CheckCancellationNest(
378 void CheckReductionObjects(
387 void ChecksOnOrderedAsBlock();
390 void ChecksOnOrderedAsStandalone();
391 void CheckOrderedDependClause(std::optional<std::int64_t> orderedValue);
392 void CheckReductionArraySection(
395 const parser::Name &name,
const llvm::omp::Clause clause);
396 void CheckLastPartRefForArraySection(
398 void CheckSharedBindingInOuterContext(
404 void CheckAllowedRequiresClause(llvm::omp::Clause clause);
407 void EnterDirectiveNest(
const int index) { directiveNest_[index]++; }
408 void ExitDirectiveNest(
const int index) { directiveNest_[index]--; }
409 int GetDirectiveNest(
const int index) {
return directiveNest_[index]; }
411 bool deviceConstructFound_{
false};
412 enum directiveNestType :
int {
414 TargetBlockOnlyTeams,
419 LastType = MetadirectiveNest,
421 int directiveNest_[LastType + 1] = {0};
423 std::set<std::pair<const Symbol *, const Symbol *>> declareVariantPairs_;
425 int allocateDirectiveLevel_{0};
431 std::vector<LoopOrConstruct> constructStack_;
433 std::vector<const Scope *> scopeStack_;
437 std::vector<const parser::OmpDirectiveSpecification *> dirStack_;
439 enum class PartKind :
int {
445 std::vector<PartKind> partStack_;
447 std::multimap<
const parser::Label,
448 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>
450 std::map<
const parser::Label,
451 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>