diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/OpenMPClause.cpp | 9 | ||||
-rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 1 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 23 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 1 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 1 |
5 files changed, 21 insertions, 14 deletions
diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp index ccb3cd34360..fe1334469d4 100644 --- a/clang/lib/AST/OpenMPClause.cpp +++ b/clang/lib/AST/OpenMPClause.cpp @@ -90,6 +90,8 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) { return static_cast<const OMPNumTasksClause *>(C); case OMPC_final: return static_cast<const OMPFinalClause *>(C); + case OMPC_priority: + return static_cast<const OMPPriorityClause *>(C); case OMPC_default: case OMPC_proc_bind: case OMPC_safelen: @@ -117,7 +119,6 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) { case OMPC_threads: case OMPC_simd: case OMPC_map: - case OMPC_priority: case OMPC_nogroup: case OMPC_hint: case OMPC_defaultmap: @@ -255,6 +256,12 @@ OMPClause::child_range OMPFinalClause::used_children() { return child_range(&Condition, &Condition + 1); } +OMPClause::child_range OMPPriorityClause::used_children() { + if (Stmt **C = getAddrOfExprAsWritten(getPreInitStmt())) + return child_range(C, C + 1); + return child_range(&Priority, &Priority + 1); +} + OMPOrderedClause *OMPOrderedClause::Create(const ASTContext &C, Expr *Num, unsigned NumLoops, SourceLocation StartLoc, diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index e536abfe35d..1cc36623d45 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -737,6 +737,7 @@ void OMPClauseProfiler::VisitOMPThreadLimitClause( Profiler->VisitStmt(C->getThreadLimit()); } void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) { + VistOMPClauseWithPreInit(C); if (C->getPriority()) Profiler->VisitStmt(C->getPriority()); } diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index b3f711bc7fa..3000469b0c9 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -4591,16 +4591,9 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( case OMPC_schedule: break; case OMPC_grainsize: - // Do not analyze if no parent parallel directive. - if (isOpenMPParallelDirective(DSAStack->getCurrentDirective())) - break; - continue; case OMPC_num_tasks: - // Do not analyze if no parent parallel directive. - if (isOpenMPParallelDirective(DSAStack->getCurrentDirective())) - break; - continue; case OMPC_final: + case OMPC_priority: // Do not analyze if no parent parallel directive. if (isOpenMPParallelDirective(DSAStack->getCurrentDirective())) break; @@ -4609,7 +4602,6 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( case OMPC_device: case OMPC_num_teams: case OMPC_thread_limit: - case OMPC_priority: case OMPC_hint: case OMPC_collapse: case OMPC_safelen: @@ -10788,6 +10780,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( case OMPC_grainsize: case OMPC_num_tasks: case OMPC_final: + case OMPC_priority: switch (DKind) { case OMPD_task: case OMPD_taskloop: @@ -10888,7 +10881,6 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( case OMPC_threads: case OMPC_simd: case OMPC_map: - case OMPC_priority: case OMPC_nogroup: case OMPC_hint: case OMPC_defaultmap: @@ -15937,14 +15929,19 @@ OMPClause *Sema::ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation LParenLoc, SourceLocation EndLoc) { Expr *ValExpr = Priority; + Stmt *HelperValStmt = nullptr; + OpenMPDirectiveKind CaptureRegion = OMPD_unknown; // OpenMP [2.9.1, task Constrcut] // The priority-value is a non-negative numerical scalar expression. - if (!isNonNegativeIntegerValue(ValExpr, *this, OMPC_priority, - /*StrictlyPositive=*/false)) + if (!isNonNegativeIntegerValue( + ValExpr, *this, OMPC_priority, + /*StrictlyPositive=*/false, /*BuildCapture=*/true, + DSAStack->getCurrentDirective(), &CaptureRegion, &HelperValStmt)) return nullptr; - return new (Context) OMPPriorityClause(ValExpr, StartLoc, LParenLoc, EndLoc); + return new (Context) OMPPriorityClause(ValExpr, HelperValStmt, CaptureRegion, + StartLoc, LParenLoc, EndLoc); } OMPClause *Sema::ActOnOpenMPGrainsizeClause(Expr *Grainsize, diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index dc653039f5c..2d3884ebe02 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -12996,6 +12996,7 @@ void OMPClauseReader::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) { } void OMPClauseReader::VisitOMPPriorityClause(OMPPriorityClause *C) { + VisitOMPClauseWithPreInit(C); C->setPriority(Record.readSubExpr()); C->setLParenLoc(Record.readSourceLocation()); } diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 1e76c328a1f..6f3b367aed4 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -6977,6 +6977,7 @@ void OMPClauseWriter::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) { } void OMPClauseWriter::VisitOMPPriorityClause(OMPPriorityClause *C) { + VisitOMPClauseWithPreInit(C); Record.AddStmt(C->getPriority()); Record.AddSourceLocation(C->getLParenLoc()); } |