-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[clang][OpenMP] 6.0: Add default clause support for 'target' directive #162910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
4ac6d51
db1d668
ee3680f
fa311f8
522cd23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17316,45 +17316,101 @@ OMPClause *SemaOpenMP::ActOnOpenMPDefaultClause( | |||||
| << getOpenMPClauseNameForDiag(OMPC_default); | ||||||
| return nullptr; | ||||||
| } | ||||||
| if (VCKind == OMPC_DEFAULT_VC_unknown) { | ||||||
| Diag(VCKindLoc, diag::err_omp_default_vc) | ||||||
| << getOpenMPSimpleClauseTypeName(OMPC_default, unsigned(M)); | ||||||
| return nullptr; | ||||||
| } | ||||||
| bool IsTargetDefault = getLangOpts().OpenMP >= 60 && | ||||||
| DSAStack->getCurrentDirective() == OMPD_target; | ||||||
|
|
||||||
| // OpenMP 6.0, page 224, lines 3-4 default Clause, Semantics | ||||||
| // If data-sharing-attribute is shared then the clause has no effect | ||||||
| // on a target construct; | ||||||
| if (IsTargetDefault && M == OMP_DEFAULT_shared) | ||||||
| return nullptr; | ||||||
|
|
||||||
| OpenMPDefaultmapClauseModifier DefMapMod; | ||||||
| OpenMPDefaultmapClauseKind DefMapKind; | ||||||
| std::function<void(SourceLocation)> SetDefaultDSA; | ||||||
|
||||||
| auto &&SetDefaultClauseAttrs = [&](llvm::omp::DefaultKind M, | |
| auto SetDefaultClauseAttrs = [&](llvm::omp::DefaultKind M, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks, Alexey.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why just not put this whole logic in lambda and call it, where required, instead of having std:function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this suggestion, Alexey. I'll try adapting the code to use this approach and see how it works out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about combined directives?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. This should apply for combined directives. Thanks for catching this, Alexey.