-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[Clang][OpenMP]Default clause variable category #157063
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 5 commits
dce17e9
f8a23a0
3d6a174
3331328
ad9ec86
01e164f
3393f23
0f4a884
803bc30
aa4c607
0653c90
76e7d98
38d44c7
704e7df
36a7d35
016fd42
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3083,7 +3083,6 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind, | |||||
| Clause = ParseOpenMPSingleExprClause(CKind, WrongDirective); | ||||||
| break; | ||||||
| case OMPC_fail: | ||||||
| case OMPC_default: | ||||||
| case OMPC_proc_bind: | ||||||
| case OMPC_atomic_default_mem_order: | ||||||
| case OMPC_at: | ||||||
|
|
@@ -3115,6 +3114,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind, | |||||
| case OMPC_schedule: | ||||||
| case OMPC_dist_schedule: | ||||||
| case OMPC_defaultmap: | ||||||
| case OMPC_default: | ||||||
| case OMPC_order: | ||||||
| // OpenMP [2.7.1, Restrictions, p. 3] | ||||||
| // Only one schedule clause can appear on a loop directive. | ||||||
|
|
@@ -3734,6 +3734,31 @@ OMPClause *Parser::ParseOpenMPSingleExprWithArgClause(OpenMPDirectiveKind DKind, | |||||
| ConsumeAnyToken(); | ||||||
| if (Arg.back() == OMPC_DIST_SCHEDULE_static && Tok.is(tok::comma)) | ||||||
| DelimLoc = ConsumeAnyToken(); | ||||||
| } else if (Kind == OMPC_default) { | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a check for version 6.0?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is applicable for even versions before 6.0. Within this if there is another The rest of the code below |
||||||
| // Get a default modifier | ||||||
| unsigned Modifier = getOpenMPSimpleClauseType( | ||||||
| Kind, Tok.isAnnotation() ? "" : PP.getSpelling(Tok), getLangOpts()); | ||||||
|
|
||||||
| Arg.push_back(Modifier); | ||||||
| KLoc.push_back(Tok.getLocation()); | ||||||
| if (Tok.isNot(tok::r_paren) && Tok.isNot(tok::comma) && | ||||||
| Tok.isNot(tok::annot_pragma_openmp_end)) | ||||||
| ConsumeAnyToken(); | ||||||
| // Parse ':' | ||||||
| if (Tok.is(tok::colon) && getLangOpts().OpenMP >= 60) { | ||||||
| ConsumeAnyToken(); | ||||||
| // Get a variable-category attribute for default clause modifier | ||||||
| unsigned VariableCategory = getOpenMPDefaultVariableCategory( | ||||||
| Tok.isAnnotation() ? "" : PP.getSpelling(Tok), getLangOpts()); | ||||||
| Arg.push_back(VariableCategory); | ||||||
| KLoc.push_back(Tok.getLocation()); | ||||||
| if (Tok.isNot(tok::r_paren) && Tok.isNot(tok::comma) && | ||||||
| Tok.isNot(tok::annot_pragma_openmp_end)) | ||||||
| ConsumeAnyToken(); | ||||||
| } else { | ||||||
| Arg.push_back(OMPC_DEFAULT_VC_all); | ||||||
| KLoc.push_back(SourceLocation()); | ||||||
| } | ||||||
| } else if (Kind == OMPC_defaultmap) { | ||||||
| // Get a defaultmap modifier | ||||||
| unsigned Modifier = getOpenMPSimpleClauseType( | ||||||
|
|
@@ -3932,6 +3957,18 @@ OMPClause *Parser::ParseOpenMPSingleExprWithArgClause(OpenMPDirectiveKind DKind, | |||||
| if (NeedAnExpression && Val.isInvalid()) | ||||||
| return nullptr; | ||||||
|
|
||||||
| if (Kind == OMPC_default && getLangOpts().OpenMP < 51 && Arg[0] && | ||||||
| (static_cast<DefaultKind>(Arg[0]) == OMP_DEFAULT_private || | ||||||
| static_cast<DefaultKind>(Arg[0]) == OMP_DEFAULT_firstprivate)) { | ||||||
| Diag(KLoc[0], diag::err_omp_invalid_dsa) | ||||||
| << getOpenMPClauseName(static_cast<DefaultKind>(Arg[0]) == | ||||||
| OMP_DEFAULT_private | ||||||
| ? OMPC_private | ||||||
| : OMPC_firstprivate) | ||||||
| << getOpenMPClauseName(OMPC_default) << "5.1"; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
5.1 is not always correct here, it may be 5.2 or 4.5
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the spec version 5.0 (for c/c++) , default clause has only
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, ok, I see, then keep it as is |
||||||
| return nullptr; | ||||||
| } | ||||||
|
|
||||||
| if (ParseOnly) | ||||||
| return nullptr; | ||||||
| return Actions.OpenMP().ActOnOpenMPSingleExprWithArgClause( | ||||||
|
|
||||||
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.