[PATCH] D119615: [CUDA][HIP] Do not promote constexpr var with non-constant initializer

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 12 00:01:06 PST 2022


tra accepted this revision.
tra added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Sema/SemaCUDA.cpp:148-150
+  if ((Var->isConstexpr() || Var->getType().isConstQualified()) &&
+      Var->hasAttr<CUDAConstantAttr>() &&
       !hasExplicitAttr<CUDAConstantAttr>(Var))
----------------
So the idea here is that the constexpr vars that have an initializer that may not be static enough for CUDA would not get the implicit __const__ attribute. I.e. it's tied to the change below that checks for allowed initializers.
We could use a comment about that here.


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

https://reviews.llvm.org/D119615



More information about the cfe-commits mailing list