[clang][OpenMP] Implement isOpenMPExecutableDirective (#97089)
What is considered "executable" in clang differs slightly from the OpenMP's "executable" category. In addition to the executable category, subsidiary directives, and OMPD_error are considered executable. Implement a function that performs that check.
This commit is contained in:
parent
101a936bde
commit
0ce801f91c
@ -368,6 +368,14 @@ bool needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind);
|
||||
/// is restricted only to memory order clauses of "OMPC_acquire",
|
||||
/// "OMPC_relaxed" and "OMPC_seq_cst".
|
||||
bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter);
|
||||
|
||||
/// Checks if the specified directive is considered as "executable". This
|
||||
/// combines the OpenMP categories of "executable" and "subsidiary", plus
|
||||
/// any other directives that should be treated as executable.
|
||||
/// \param DKind Specified directive.
|
||||
/// \return true - if the above condition is met for this directive
|
||||
/// otherwise - false.
|
||||
bool isOpenMPExecutableDirective(OpenMPDirectiveKind DKind);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -702,6 +702,13 @@ bool clang::needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind) {
|
||||
DKind == OMPD_target_parallel_loop;
|
||||
}
|
||||
|
||||
bool clang::isOpenMPExecutableDirective(OpenMPDirectiveKind DKind) {
|
||||
if (DKind == OMPD_error)
|
||||
return true;
|
||||
Category Cat = getDirectiveCategory(DKind);
|
||||
return Cat == Category::Executable || Cat == Category::Subsidiary;
|
||||
}
|
||||
|
||||
void clang::getOpenMPCaptureRegions(
|
||||
SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
|
||||
OpenMPDirectiveKind DKind) {
|
||||
|
||||
@ -2397,10 +2397,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
|
||||
StmtResult Parser::ParseOpenMPExecutableDirective(
|
||||
ParsedStmtContext StmtCtx, OpenMPDirectiveKind DKind, SourceLocation Loc,
|
||||
bool ReadDirectiveWithinMetadirective) {
|
||||
assert((DKind == OMPD_error ||
|
||||
getDirectiveCategory(DKind) == Category::Executable ||
|
||||
getDirectiveCategory(DKind) == Category::Subsidiary) &&
|
||||
"Directive with an unexpected category");
|
||||
assert(isOpenMPExecutableDirective(DKind) && "Unexpected directive category");
|
||||
|
||||
bool HasAssociatedStatement = true;
|
||||
Association Assoc = getDirectiveAssociation(DKind);
|
||||
|
||||
|
||||
@ -6357,6 +6357,8 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
|
||||
OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
|
||||
Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
OpenMPDirectiveKind PrevMappedDirective) {
|
||||
assert(isOpenMPExecutableDirective(Kind) && "Unexpected directive category");
|
||||
|
||||
StmtResult Res = StmtError();
|
||||
OpenMPBindClauseKind BindKind = OMPC_BIND_unknown;
|
||||
llvm::SmallVector<OMPClause *> ClausesWithoutBind;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user