[PATCH] D79344: [cuda] Start diagnosing variables with bad target.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 13:27:03 PDT 2020


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


================
Comment at: clang/lib/Sema/SemaCUDA.cpp:156
+  if (VD->getType()->isCUDADeviceBuiltinSurfaceType() ||
+      VD->getType()->isCUDADeviceBuiltinTextureType())
+    return CFT_HostDevice;
----------------
yaxunl wrote:
> We may need to mark constexpr variables as host device too. In practice such usage has exist for long time.
`cosntexpr` variable is a little bit tricky as it's still possible for that variable to be finally emitted as a variable. For example, if its address is taken, it won't be optimized away and still needs emitting somewhere. But, like other non-local variables, CUDA forbids their initializers. Any suggestion?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79344





More information about the cfe-commits mailing list