ABataev 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);
----------------
cchen wrote:
> 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?
Could you set `OMPC_DEFAULTMAP_MODIFIER_unknown` as an initial value? Or set 
`OMPC_DEFAULTMAP_MODIFIER_unknown` as thr first enum with value `0` and instead 
add something like `OMPC_DEFAULTMAP_MODIFIER_last` and use it everywhere in the 
code where you need the number of values instead of 
`OMPC_DEFAULTMAP_MODIFIER_unknown`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69204



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to