[PATCH] D112110: [OpenCL] queue_t and ndrange_t can't be defined in program scope.

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 16 05:27:35 PST 2021


Anastasia added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:6853
+    if (R->isReserveIDT() || R->isClkEventT() || R->isEventT() ||
+        R.getUnqualifiedType().getAsString() == "ndrange_t" || R->isQueueT()) {
       Se.Diag(NewVD->getLocation(),
----------------
cycheng wrote:
> Anastasia wrote:
> > Suggest swapping those as string comparisons are more costly.
> > 
> > However, does it work if there is a typedef of `ndrange_t` to some other name? Although it feels like the same issue might apply to other types diagnosed here...
> > does it work if there is a typedef of ndrange_t to some other name?
> No, should we recursively check it?
> Or do we have better way to handle this?
We should be able to do this by using canonical type in the checks:
https://clang.llvm.org/doxygen/classclang_1_1QualType.html#a900520b154ba282febbaa7267020ca3f


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

https://reviews.llvm.org/D112110



More information about the cfe-commits mailing list