66class OmpStructureChecker :
public OmpStructureCheckerBase {
68 using Base = OmpStructureCheckerBase;
82 bool Enter(
const parser::EndSubroutineStmt &);
84 bool Enter(
const parser::EndFunctionStmt &);
92 void Enter(
const parser::ExecutionPart &);
93 void Leave(
const parser::ExecutionPart &);
182 void Enter(
const parser::OmpContextSelector &);
183 void Leave(
const parser::OmpContextSelector &);
186 void Leave(
const parser::GotoStmt &);
190 void Leave(
const parser::AltReturnSpec &);
191 void Leave(
const parser::ErrLabel &);
192 void Leave(
const parser::EndLabel &);
193 void Leave(
const parser::EorLabel &);
195#define GEN_FLANG_CLAUSE_CHECK_ENTER
196#include "llvm/Frontend/OpenMP/OMP.inc"
210 std::string_view name,
bool checkTypeOnPointer =
true);
219 void CheckAtomicReadAssignment(
221 void CheckAtomicWriteAssignment(
223 std::optional<evaluate::Assignment> CheckAtomicUpdateAssignment(
225 std::pair<bool, bool> CheckAtomicUpdateAssignmentRhs(
const SomeExpr &atom,
227 void CheckAtomicConditionalUpdateAssignment(
const SomeExpr &cond,
230 void CheckAtomicConditionalUpdateStmt(
238 void CheckAtomicConditionalUpdateCapture(
256 void CheckScanModifier(
const parser::OmpClause::Reduction &x);
260 const std::list<parser::OmpTraitProperty> &GetTraitPropertyList(
262 std::optional<llvm::omp::Clause> GetClauseFromProperty(
265 void CheckTraitSelectorList(
const std::list<parser::OmpTraitSelector> &);
268 bool VerifyTraitPropertyLists(
270 void CheckTraitSelector(
274 void CheckTraitCondition(
276 void CheckTraitDeviceNum(
278 void CheckTraitRequires(
284 bool IsAllowedClause(llvm::omp::Clause clauseId);
285 bool CheckAllowedClause(llvm::omp::Clause clause);
286 void CheckVariableListItem(
const SymbolSourceMap &symbols);
287 void CheckDirectiveSpelling(
294 void CheckSourceLabel(
const parser::Label &);
298 void CheckMultipleOccurrence(semantics::UnorderedSymbolSet &listVars,
300 const std::string &clauseName);
301 void CheckMultListItems();
302 void CheckStructureComponent(
304 bool HasInvalidWorksharingNesting(
307 bool IsCloselyNestedRegion(
const OmpDirectiveSet &set);
308 bool IsNestedInDirective(llvm::omp::Directive directive);
309 bool IsCombinedParallelWorksharing(llvm::omp::Directive directive)
const;
310 bool InTargetRegion();
311 void HasInvalidTeamsNesting(
313 bool HasRequires(llvm::omp::Clause req);
314 void CheckAllowedMapTypes(
317 llvm::StringRef getClauseName(llvm::omp::Clause clause)
override;
318 llvm::StringRef getDirectiveName(llvm::omp::Directive directive)
override;
321 typename LessTy,
typename RangeTy,
322 typename IterTy =
decltype(std::declval<RangeTy>().begin())>
323 std::optional<IterTy> FindDuplicate(RangeTy &&);
335 void CheckThreadprivateOrDeclareTargetVar(
const parser::Name &);
338 void CheckSymbolName(
340 void CheckSymbolNames(
342 void CheckIntentInPointer(SymbolSourceMap &,
const llvm::omp::Clause);
343 void CheckAssumedSizeArray(SymbolSourceMap &,
const llvm::omp::Clause);
344 void CheckProcedurePointer(SymbolSourceMap &,
const llvm::omp::Clause);
346 llvm::StringRef clause,
bool suggestToUseCrayPointer =
true);
348 void CheckDefinableObjects(SymbolSourceMap &,
const llvm::omp::Clause);
349 void CheckCopyingPolymorphicAllocatable(
350 SymbolSourceMap &,
const llvm::omp::Clause);
351 void CheckPrivateSymbolsInOuterCxt(
352 SymbolSourceMap &, DirectivesClauseTriple &,
const llvm::omp::Clause);
353 bool CheckTargetBlockOnlyTeams(
const parser::Block &);
356 void CheckIndividualAllocateDirective(
364 void CheckTargetUpdate();
366 void CheckDependenceType(
const parser::OmpDependenceType::Value &x);
367 void CheckTaskDependenceType(
const parser::OmpTaskDependenceType::Value &x);
368 std::optional<llvm::omp::Directive> GetCancelType(
370 const std::optional<parser::OmpClauseList> &maybeClauses);
371 void CheckCancellationNest(
373 void CheckReductionObjects(
382 void ChecksOnOrderedAsBlock();
385 void ChecksOnOrderedAsStandalone();
386 void CheckOrderedDependClause(std::optional<std::int64_t> orderedValue);
387 void CheckReductionArraySection(
390 const parser::Name &name,
const llvm::omp::Clause clause);
391 void CheckLastPartRefForArraySection(
393 void CheckSharedBindingInOuterContext(
399 void CheckAllowedRequiresClause(llvm::omp::Clause clause);
402 void EnterDirectiveNest(
const int index) { directiveNest_[index]++; }
403 void ExitDirectiveNest(
const int index) { directiveNest_[index]--; }
404 int GetDirectiveNest(
const int index) {
return directiveNest_[index]; }
406 bool deviceConstructFound_{
false};
407 enum directiveNestType :
int {
409 TargetBlockOnlyTeams,
414 LastType = MetadirectiveNest,
416 int directiveNest_[LastType + 1] = {0};
418 int allocateDirectiveLevel_{0};
424 std::vector<LoopOrConstruct> constructStack_;
426 std::vector<const Scope *> scopeStack_;
430 std::vector<const parser::OmpDirectiveSpecification *> dirStack_;
432 enum class PartKind :
int {
438 std::vector<PartKind> partStack_;
440 std::multimap<
const parser::Label,
441 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>
443 std::map<
const parser::Label,
444 std::pair<parser::CharBlock, const parser::OpenMPConstruct *>>