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 &&);
337 void CheckTypeParamInquiry(
339 void CheckTypeParamInquiry(
346 void CheckThreadprivateOrDeclareTargetVar(
const parser::Name &);
349 void CheckSymbolName(
351 void CheckSymbolNames(
353 void CheckIntentInPointer(SymbolSourceMap &,
const llvm::omp::Clause);
354 void CheckAssumedSizeArray(SymbolSourceMap &,
const llvm::omp::Clause);
355 void CheckProcedurePointer(SymbolSourceMap &,
const llvm::omp::Clause);
357 llvm::StringRef clause,
bool suggestToUseCrayPointer =
true);
359 void CheckDefinableObjects(SymbolSourceMap &,
const llvm::omp::Clause);
360 void CheckCopyingPolymorphicAllocatable(
361 SymbolSourceMap &,
const llvm::omp::Clause);
362 void CheckPrivateSymbolsInOuterCxt(
363 SymbolSourceMap &, DirectivesClauseTriple &,
const llvm::omp::Clause);
364 bool CheckTargetBlockOnlyTeams(
const parser::Block &);
367 void CheckIndividualAllocateDirective(
375 void CheckTargetUpdate();
377 void CheckDependenceType(
const parser::OmpDependenceType::Value &x);
378 void CheckTaskDependenceType(
const parser::OmpTaskDependenceType::Value &x);
379 std::optional<llvm::omp::Directive> GetCancelType(
381 const std::optional<parser::OmpClauseList> &maybeClauses);
382 void CheckCancellationNest(
384 void CheckReductionObjects(
393 void ChecksOnOrderedAsBlock();
396 void ChecksOnOrderedAsStandalone();
397 void CheckOrderedDependClause(std::optional<std::int64_t> orderedValue);
398 void CheckReductionArraySection(
401 const parser::Name &name,
const llvm::omp::Clause clause);
402 void CheckLastPartRefForArraySection(
404 void CheckSharedBindingInOuterContext(
410 void CheckAllowedRequiresClause(llvm::omp::Clause clause);
413 void EnterDirectiveNest(
const int index) { directiveNest_[index]++; }
414 void ExitDirectiveNest(
const int index) { directiveNest_[index]--; }
415 int GetDirectiveNest(
const int index) {
return directiveNest_[index]; }
417 bool deviceConstructFound_{
false};
418 enum directiveNestType :
int {
420 TargetBlockOnlyTeams,
425 LastType = MetadirectiveNest,
427 int directiveNest_[LastType + 1] = {0};
429 std::set<std::pair<const Symbol *, const Symbol *>> declareVariantPairs_;
431 int allocateDirectiveLevel_{0};
437 std::vector<LoopOrConstruct> constructStack_;
439 std::vector<const Scope *> scopeStack_;
443 std::vector<const parser::OmpDirectiveSpecification *> dirStack_;
445 enum class PartKind :
int {
451 std::vector<PartKind> partStack_;
453 std::multimap<
const parser::Label,
454 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>
456 std::map<
const parser::Label,
457 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>