rjmccall added inline comments.

================
Comment at: clang/lib/Sema/SemaType.cpp:2188
+               !Context.getTargetInfo().isVLASupported() &&
+               shouldDiagnoseTargetSupportFromOpenMP()) {
+      // Some targets don't support VLAs.
----------------
Please write this check so that it trips in an "ordinary" build on a target 
that just happens to not support VLAs, something like:

  else if (!Context.getTargetInfo().isVLASupported() && 
shouldDiagnoseTargetSupportFromOpenMP())

If you want to include the explicit OpenMP check there, it would need to be:

  else if (!Context.getTargetInfo().isVLASupported() && (!getLangOpts().OpenMP 
|| shouldDiagnoseTargetSupportFromOpenMP()))

but I think the first looks better.

The CUDA and OpenMP paths here seem to be trying to achieve analogous things; 
it's unfortunate that we can't find a way to unify their approaches, even if 
we'd eventually want to use different diagnostic text.  I imagine that the 
target-environment language restrictions are basically the same, since they 
arise for the same fundamental reasons, so all the places using 
CUDADiagIfDeviceCode are likely to have a check for 
shouldDiagnoseTargetSupportFromOpenMP() and vice-versa.


https://reviews.llvm.org/D40275



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

Reply via email to