[PATCH] D70142: [OpenMP5.0] Fix a parsing issue for the extended defaultmap
Chi Chun Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 12 13:34:41 PST 2019
cchen created this revision.
cchen added a reviewer: ABataev.
Herald added subscribers: cfe-commits, guansong.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.
cchen retitled this revision from "[OpenMP5.0] Fix a parsing issue for the extended defaultmap
This patch is for fixing a possible parsing issue in the OpenMP5.0 defaultmap patch.
In this case: "#pragma omp target defaultmap(scalar:", the implicit-behavior after the parsing will..." to "[OpenMP5.0] Fix a parsing issue for the extended defaultmap".
cchen edited the summary of this revision.
cchen removed a subscriber: guansong.
This patch is for fixing a possible parsing issue in the OpenMP5.0 defaultmap patch.
In this case:
#pragma omp target defaultmap(scalar:
the implicit-behavior after the parsing will not be OMPC_DEFAULTMAP_MODIFIER_unknown.
So we need to either enforce the enum value of implicit behavior to be unknown or modify the logic inside getOpenMPSimpleClauseType.
And we now choose to just enforce the enum value of implicit behavior to be unknown.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70142
Files:
clang/lib/Parse/ParseOpenMP.cpp
Index: clang/lib/Parse/ParseOpenMP.cpp
===================================================================
--- clang/lib/Parse/ParseOpenMP.cpp
+++ clang/lib/Parse/ParseOpenMP.cpp
@@ -2310,8 +2310,14 @@
DelimLoc = ConsumeAnyToken();
} else if (Kind == OMPC_defaultmap) {
// Get a defaultmap modifier
- Arg.push_back(getOpenMPSimpleClauseType(
- Kind, Tok.isAnnotation() ? "" : PP.getSpelling(Tok)));
+ unsigned Modifier = getOpenMPSimpleClauseType(
+ Kind, Tok.isAnnotation() ? "" : PP.getSpelling(Tok));
+ // Set defaultmap modifier to unknown if it is either scalar, aggregate, or
+ // pointer (modifier should be either alloc, to, from, tofrom, firstprivate,
+ // none, or default)
+ if (Modifier < OMPC_DEFAULTMAP_MODIFIER_unknown)
+ Modifier = OMPC_DEFAULTMAP_MODIFIER_unknown;
+ 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))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70142.228951.patch
Type: text/x-patch
Size: 1015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191112/b08157db/attachment.bin>
More information about the cfe-commits
mailing list