66class OmpStructureChecker :
public OmpStructureCheckerBase {
68 using Base = OmpStructureCheckerBase;
82 bool Enter(
const parser::EndSubroutineStmt &);
84 bool Enter(
const parser::EndFunctionStmt &);
85 bool Enter(
const parser::MpSubprogramStmt &);
86 bool 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 const std::list<parser::OmpTraitProperty> &GetTraitPropertyList(
264 std::optional<llvm::omp::Clause> GetClauseFromProperty(
267 void CheckTraitSelectorList(
const std::list<parser::OmpTraitSelector> &);
270 bool VerifyTraitPropertyLists(
272 void CheckTraitSelector(
276 void CheckTraitCondition(
278 void CheckTraitDeviceNum(
280 void CheckTraitRequires(
286 bool IsAllowedClause(llvm::omp::Clause clauseId);
287 bool CheckAllowedClause(llvm::omp::Clause clause);
288 void CheckVariableListItem(
const SymbolSourceMap &symbols);
289 void CheckDirectiveSpelling(
296 void CheckSourceLabel(
const parser::Label &);
300 void CheckMultipleOccurrence(semantics::UnorderedSymbolSet &listVars,
302 const std::string &clauseName);
303 void CheckMultListItems();
304 void CheckStructureComponent(
306 bool HasInvalidWorksharingNesting(
309 bool IsCloselyNestedRegion(
const OmpDirectiveSet &set);
310 bool IsNestedInDirective(llvm::omp::Directive directive);
311 bool IsCombinedParallelWorksharing(llvm::omp::Directive directive)
const;
312 bool InTargetRegion();
313 void HasInvalidTeamsNesting(
315 bool HasRequires(llvm::omp::Clause req);
316 void CheckAllowedMapTypes(
319 llvm::StringRef getClauseName(llvm::omp::Clause clause)
override;
320 llvm::StringRef getDirectiveName(llvm::omp::Directive directive)
override;
323 typename LessTy,
typename RangeTy,
324 typename IterTy =
decltype(std::declval<RangeTy>().begin())>
325 std::optional<IterTy> FindDuplicate(RangeTy &&);
337 void CheckThreadprivateOrDeclareTargetVar(
const parser::Name &);
340 void CheckSymbolName(
342 void CheckSymbolNames(
344 void CheckIntentInPointer(SymbolSourceMap &,
const llvm::omp::Clause);
345 void CheckAssumedSizeArray(SymbolSourceMap &,
const llvm::omp::Clause);
346 void CheckProcedurePointer(SymbolSourceMap &,
const llvm::omp::Clause);
348 llvm::StringRef clause,
bool suggestToUseCrayPointer =
true);
350 void CheckDefinableObjects(SymbolSourceMap &,
const llvm::omp::Clause);
351 void CheckCopyingPolymorphicAllocatable(
352 SymbolSourceMap &,
const llvm::omp::Clause);
353 void CheckPrivateSymbolsInOuterCxt(
354 SymbolSourceMap &, DirectivesClauseTriple &,
const llvm::omp::Clause);
355 bool CheckTargetBlockOnlyTeams(
const parser::Block &);
358 void CheckIndividualAllocateDirective(
366 void CheckTargetUpdate();
368 void CheckDependenceType(
const parser::OmpDependenceType::Value &x);
369 void CheckTaskDependenceType(
const parser::OmpTaskDependenceType::Value &x);
370 std::optional<llvm::omp::Directive> GetCancelType(
372 const std::optional<parser::OmpClauseList> &maybeClauses);
373 void CheckCancellationNest(
375 void CheckReductionObjects(
384 void ChecksOnOrderedAsBlock();
387 void ChecksOnOrderedAsStandalone();
388 void CheckOrderedDependClause(std::optional<std::int64_t> orderedValue);
389 void CheckReductionArraySection(
392 const parser::Name &name,
const llvm::omp::Clause clause);
393 void CheckLastPartRefForArraySection(
395 void CheckSharedBindingInOuterContext(
401 void CheckAllowedRequiresClause(llvm::omp::Clause clause);
404 void EnterDirectiveNest(
const int index) { directiveNest_[index]++; }
405 void ExitDirectiveNest(
const int index) { directiveNest_[index]--; }
406 int GetDirectiveNest(
const int index) {
return directiveNest_[index]; }
408 bool deviceConstructFound_{
false};
409 enum directiveNestType :
int {
411 TargetBlockOnlyTeams,
416 LastType = MetadirectiveNest,
418 int directiveNest_[LastType + 1] = {0};
420 int allocateDirectiveLevel_{0};
426 std::vector<LoopOrConstruct> constructStack_;
428 std::vector<const Scope *> scopeStack_;
432 std::vector<const parser::OmpDirectiveSpecification *> dirStack_;
434 enum class PartKind :
int {
440 std::vector<PartKind> partStack_;
442 std::multimap<
const parser::Label,
443 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>
445 std::map<
const parser::Label,
446 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>