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

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 15 07:59:25 PST 2022


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


================
Comment at: clang/lib/Sema/SemaCUDA.cpp:148-150
+  if ((Var->isConstexpr() || Var->getType().isConstQualified()) &&
+      Var->hasAttr<CUDAConstantAttr>() &&
       !hasExplicitAttr<CUDAConstantAttr>(Var))
----------------
tra wrote:
> 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.
will add a comment when committing


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

https://reviews.llvm.org/D119615



More information about the cfe-commits mailing list