-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[flang][OpenMP] Use OmpDirectiveSpecification in METADIRECTIVE #159577
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 2 commits
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 |
|---|---|---|
|
|
@@ -1008,11 +1008,11 @@ TYPE_PARSER(construct<OmpMatchClause>( | |
| Parser<traits::OmpContextSelectorSpecification>{})) | ||
|
|
||
| TYPE_PARSER(construct<OmpOtherwiseClause>( | ||
| maybe(indirect(sourced(Parser<OmpDirectiveSpecification>{}))))) | ||
| maybe(indirect(Parser<OmpDirectiveSpecification>{})))) | ||
|
|
||
| TYPE_PARSER(construct<OmpWhenClause>( | ||
| maybe(nonemptyList(Parser<OmpWhenClause::Modifier>{}) / ":"), | ||
| maybe(indirect(sourced(Parser<OmpDirectiveSpecification>{}))))) | ||
| maybe(indirect(Parser<OmpDirectiveSpecification>{})))) | ||
|
|
||
| // OMP 5.2 12.6.1 grainsize([ prescriptiveness :] scalar-integer-expression) | ||
| TYPE_PARSER(construct<OmpGrainsizeClause>( | ||
|
|
@@ -1281,6 +1281,16 @@ TYPE_PARSER(sourced(construct<OmpErrorDirective>( | |
|
|
||
| // --- Parsers for directives and constructs -------------------------- | ||
|
|
||
| static inline constexpr auto IsDirective(llvm::omp::Directive dir) { | ||
| return [dir](const OmpDirectiveName &name) -> bool { return dir == name.v; }; | ||
| } | ||
|
|
||
| static inline constexpr auto IsMemberOf(const DirectiveSet &dirs) { | ||
| return [&dirs](const OmpDirectiveName &name) -> bool { | ||
| return dirs.test(llvm::to_underlying(name.v)); | ||
| }; | ||
| } | ||
|
|
||
| TYPE_PARSER(sourced(construct<OmpDirectiveName>(OmpDirectiveNameParser{}))) | ||
|
|
||
| OmpDirectiveSpecification static makeFlushFromOldSyntax(Verbatim &&text, | ||
|
|
@@ -1293,7 +1303,7 @@ OmpDirectiveSpecification static makeFlushFromOldSyntax(Verbatim &&text, | |
|
|
||
| TYPE_PARSER(sourced( | ||
| // Parse the old syntax: FLUSH [clauses] [(objects)] | ||
| construct<OmpDirectiveSpecification>( | ||
| sourced(construct<OmpDirectiveSpecification>( | ||
|
Contributor
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. Isn't this already inside of a
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. It is. Let me fix this...
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. Done |
||
| // Force this old-syntax parser to fail for FLUSH followed by '('. | ||
| // Otherwise it could succeed on the new syntax but have one of | ||
| // lists absent in the parsed result. | ||
|
|
@@ -1303,13 +1313,13 @@ TYPE_PARSER(sourced( | |
| verbatim("FLUSH"_tok) / !lookAhead("("_tok), | ||
| maybe(Parser<OmpClauseList>{}), | ||
| maybe(parenthesized(Parser<OmpArgumentList>{})), | ||
| pure(OmpDirectiveSpecification::Flags::DeprecatedSyntax))) || | ||
| pure(OmpDirectiveSpecification::Flags::DeprecatedSyntax)))) || | ||
| // Parse the standard syntax: directive [(arguments)] [clauses] | ||
| construct<OmpDirectiveSpecification>( // | ||
| sourced(construct<OmpDirectiveSpecification>( // | ||
| sourced(OmpDirectiveNameParser{}), | ||
| maybe(parenthesized(Parser<OmpArgumentList>{})), | ||
| maybe(Parser<OmpClauseList>{}), | ||
| pure(OmpDirectiveSpecification::Flags::None)))) | ||
| pure(OmpDirectiveSpecification::Flags::None))))) | ||
|
|
||
| static bool IsStandaloneOrdered(const OmpDirectiveSpecification &dirSpec) { | ||
| // An ORDERED construct is standalone if it has DOACROSS or DEPEND clause. | ||
|
|
@@ -1363,18 +1373,10 @@ TYPE_PARSER(sourced(construct<OpenMPUtilityConstruct>( | |
| sourced(construct<OpenMPUtilityConstruct>( | ||
| sourced(Parser<OmpNothingDirective>{})))))) | ||
|
|
||
| TYPE_PARSER(sourced(construct<OmpMetadirectiveDirective>( | ||
| verbatim("METADIRECTIVE"_tok), Parser<OmpClauseList>{}))) | ||
|
|
||
| static inline constexpr auto IsDirective(llvm::omp::Directive dir) { | ||
| return [dir](const OmpDirectiveName &name) -> bool { return dir == name.v; }; | ||
| } | ||
|
|
||
| static inline constexpr auto IsMemberOf(const DirectiveSet &dirs) { | ||
| return [&dirs](const OmpDirectiveName &name) -> bool { | ||
| return dirs.test(llvm::to_underlying(name.v)); | ||
| }; | ||
| } | ||
| TYPE_PARSER(construct<OmpMetadirectiveDirective>( | ||
| predicated(Parser<OmpDirectiveName>{}, | ||
| IsDirective(llvm::omp::Directive::OMPD_metadirective)) >= | ||
| Parser<OmpDirectiveSpecification>{})) | ||
|
|
||
| struct OmpBeginDirectiveParser { | ||
| using resultType = OmpDirectiveSpecification; | ||
|
|
||
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.
I am seeing this change a few times in your recent patches for
OmpDirectiveSpecification. I think this should be done in a NFC commit before submitting these other patches. It will reduce the diff of these patches and means this non functional change is not attached to a functional change.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: #159803