[PATCH] D69204: [OpenMP 5.0] - Extend defaultmap

Chi Chun Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 09:42:30 PST 2019


cchen marked an inline comment as done.
cchen added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:16411-16420
+    bool isDefaultmapModifier = (M == OMPC_DEFAULTMAP_MODIFIER_alloc) ||
+                                (M == OMPC_DEFAULTMAP_MODIFIER_to) ||
+                                (M == OMPC_DEFAULTMAP_MODIFIER_from) ||
+                                (M == OMPC_DEFAULTMAP_MODIFIER_tofrom) ||
+                                (M == OMPC_DEFAULTMAP_MODIFIER_firstprivate) ||
+                                (M == OMPC_DEFAULTMAP_MODIFIER_default) ||
+                                (M == OMPC_DEFAULTMAP_MODIFIER_none);
----------------
ABataev wrote:
> Just `M != OMPC_DEFAULTMAP_MODIFIER_unknown` and `Kind != OMPC_DEFAULTMAP_unknown`
Thanks for your kindly suggestion, but I'm not able to use `M != OMPC_DEFAULTMAP_MODIFIER_unknown` to deal with the case that the defaultmap modifier  never being set. For this case:
```
#pragma omp target defaultmap(scalar:
```
The defaultmap modifier returned from the parsing phase is 0 while OMPC_DEFAULTMAP_MODIFIER_unknown is set to 3 (OMPC_DEFAULTMAP_unknown). I could make the condition correct by just comparing M with 0 but this is the use of magic number, so I'm wondering should I just comparing each case explicitly (alloc, to, from...) or I'll need to fix the parsing?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69204/new/

https://reviews.llvm.org/D69204





More information about the cfe-commits mailing list