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);
292 void CheckVariableListItem(
const SymbolSourceMap &symbols);
293 void CheckDirectiveSpelling(
300 void CheckSourceLabel(
const parser::Label &);
304 void CheckMultipleOccurrence(semantics::UnorderedSymbolSet &listVars,
306 const std::string &clauseName);
307 void CheckMultListItems();
308 void CheckStructureComponent(
310 void CheckStructureComponent(
312 bool HasInvalidWorksharingNesting(
315 bool IsCloselyNestedRegion(
const OmpDirectiveSet &set);
316 bool IsNestedInDirective(llvm::omp::Directive directive);
317 bool IsCombinedParallelWorksharing(llvm::omp::Directive directive)
const;
318 bool InTargetRegion();
319 void HasInvalidTeamsNesting(
321 bool HasRequires(llvm::omp::Clause req);
322 void CheckAllowedMapTypes(
325 llvm::StringRef getClauseName(llvm::omp::Clause clause)
override;
326 llvm::StringRef getDirectiveName(llvm::omp::Directive directive)
override;
329 typename LessTy,
typename RangeTy,
330 typename IterTy =
decltype(std::declval<RangeTy>().begin())>
331 std::optional<IterTy> FindDuplicate(RangeTy &&);
342 void CheckThreadprivateOrDeclareTargetVar(
const parser::Name &);
345 void CheckSymbolName(
347 void CheckSymbolNames(
349 void CheckIntentInPointer(SymbolSourceMap &,
const llvm::omp::Clause);
350 void CheckAssumedSizeArray(SymbolSourceMap &,
const llvm::omp::Clause);
351 void CheckProcedurePointer(SymbolSourceMap &,
const llvm::omp::Clause);
353 llvm::StringRef clause,
bool suggestToUseCrayPointer =
true);
355 void CheckDefinableObjects(SymbolSourceMap &,
const llvm::omp::Clause);
356 void CheckCopyingPolymorphicAllocatable(
357 SymbolSourceMap &,
const llvm::omp::Clause);
358 void CheckPrivateSymbolsInOuterCxt(
359 SymbolSourceMap &, DirectivesClauseTriple &,
const llvm::omp::Clause);
360 bool CheckTargetBlockOnlyTeams(
const parser::Block &);
363 void CheckIndividualAllocateDirective(
371 void CheckTargetUpdate();
373 void CheckDependenceType(
const parser::OmpDependenceType::Value &x);
374 void CheckTaskDependenceType(
const parser::OmpTaskDependenceType::Value &x);
375 std::optional<llvm::omp::Directive> GetCancelType(
377 const std::optional<parser::OmpClauseList> &maybeClauses);
378 void CheckCancellationNest(
380 void CheckReductionObjects(
389 void ChecksOnOrderedAsBlock();
392 void ChecksOnOrderedAsStandalone();
393 void CheckOrderedDependClause(std::optional<std::int64_t> orderedValue);
394 void CheckReductionArraySection(
397 const parser::Name &name,
const llvm::omp::Clause clause);
398 void CheckLastPartRefForArraySection(
400 void CheckSharedBindingInOuterContext(
406 void CheckAllowedRequiresClause(llvm::omp::Clause clause);
409 void EnterDirectiveNest(
const int index) { directiveNest_[index]++; }
410 void ExitDirectiveNest(
const int index) { directiveNest_[index]--; }
411 int GetDirectiveNest(
const int index) {
return directiveNest_[index]; }
413 bool deviceConstructFound_{
false};
414 enum directiveNestType :
int {
416 TargetBlockOnlyTeams,
421 LastType = MetadirectiveNest,
423 int directiveNest_[LastType + 1] = {0};
425 std::set<std::pair<const Symbol *, const Symbol *>> declareVariantPairs_;
427 int allocateDirectiveLevel_{0};
433 std::vector<LoopOrConstruct> constructStack_;
435 std::vector<const Scope *> scopeStack_;
439 std::vector<const parser::OmpDirectiveSpecification *> dirStack_;
441 enum class PartKind :
int {
447 std::vector<PartKind> partStack_;
449 std::multimap<
const parser::Label,
450 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>
452 std::map<
const parser::Label,
453 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>