Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flang/include/flang/Parser/parse-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -5155,7 +5155,7 @@ struct OpenMPThreadprivate {
struct OpenMPDeclarativeAllocate {
TUPLE_CLASS_BOILERPLATE(OpenMPDeclarativeAllocate);
CharBlock source;
std::tuple<Verbatim, OmpObjectList, OmpClauseList> t;
std::tuple<Verbatim, std::optional<OmpObjectList>, OmpClauseList> t;
};

struct OpenMPDeclarativeConstruct {
Expand Down
2 changes: 2 additions & 0 deletions flang/include/flang/Semantics/openmp-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const parser::OmpObject *GetArgumentObject(const parser::OmpArgument &argument);
bool IsCommonBlock(const Symbol &sym);
bool IsExtendedListItem(const Symbol &sym);
bool IsVariableListItem(const Symbol &sym);
bool IsTypeParamInquiry(const Symbol &sym);
bool IsStructureComponent(const Symbol &sym);
bool IsVarOrFunctionRef(const MaybeExpr &expr);

bool IsMapEnteringType(parser::OmpMapType::Value type);
Expand Down
14 changes: 8 additions & 6 deletions flang/lib/Parser/openmp-parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2045,11 +2045,12 @@ TYPE_PARSER(sourced(construct<OpenMPCriticalConstruct>(
OmpBlockConstructParser{llvm::omp::Directive::OMPD_critical})))

// 2.11.3 Executable Allocate directive
TYPE_PARSER(
sourced(construct<OpenMPExecutableAllocate>(verbatim("ALLOCATE"_tok),
maybe(parenthesized(Parser<OmpObjectList>{})), Parser<OmpClauseList>{},
maybe(nonemptyList(Parser<OpenMPDeclarativeAllocate>{})) / endOmpLine,
statement(allocateStmt))))
TYPE_PARSER(sourced(construct<OpenMPExecutableAllocate>(
verbatim("ALLOCATE"_tok), maybe(parenthesized(Parser<OmpObjectList>{})),
Parser<OmpClauseList>{},
maybe(nonemptyList(startOmpLine >> Parser<OpenMPDeclarativeAllocate>{})) /
endOmpLine,
statement(allocateStmt))))

// 2.8.2 Declare Simd construct
TYPE_PARSER(sourced(construct<OpenMPDeclareSimdConstruct>(
Expand Down Expand Up @@ -2079,7 +2080,8 @@ TYPE_PARSER(sourced( //
// 2.11.3 Declarative Allocate directive
TYPE_PARSER(
sourced(construct<OpenMPDeclarativeAllocate>(verbatim("ALLOCATE"_tok),
parenthesized(Parser<OmpObjectList>{}), Parser<OmpClauseList>{})) /
maybe(parenthesized(Parser<OmpObjectList>{})),
Parser<OmpClauseList>{})) /
lookAhead(endOmpLine / !statement(allocateStmt)))

// Assumes Construct
Expand Down
4 changes: 1 addition & 3 deletions flang/lib/Parser/unparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2502,9 +2502,7 @@ class UnparseVisitor {
void Unparse(const OpenMPDeclarativeAllocate &x) {
BeginOpenMP();
Word("!$OMP ALLOCATE");
Put(" (");
Walk(std::get<OmpObjectList>(x.t));
Put(")");
Walk(" (", std::get<std::optional<OmpObjectList>>(x.t), ")");
Walk(std::get<OmpClauseList>(x.t));
Put("\n");
EndOpenMP();
Expand Down
Loading