rsmith accepted this revision.
rsmith added a reviewer: rsmith.
rsmith added a comment.

The change to allow `__host__ __device__` functions to be overloaded with other 
combinations of target attributes appears to be separable from the `constexpr` 
change; please split it out and commit it first.


================
Comment at: include/clang/Basic/LangOptions.def:175
@@ -174,2 +174,3 @@
 LANGOPT(CUDAAllowVariadicFunctions, 1, 0, "Allow variadic functions in CUDA 
device code")
+LANGOPT(CUDAHostDeviceConstexpr, 1, 1, "Treat unattributed constexpr functions 
as __host__ __device__")
 
----------------
This should be a noun phrase -- this string appears in contexts like "support 
for %0 is enabled" -- so this should be "treating unattributed [...]".

================
Comment at: lib/Sema/SemaDecl.cpp:8015-8017
@@ +8014,5 @@
+  // allowed, so we just treat those as host-only.
+  if (getLangOpts().CUDA && getLangOpts().CUDAHostDeviceConstexpr &&
+      NewFD->isConstexpr() && !NewFD->isVariadic() &&
+      !NewFD->hasAttr<CUDAHostAttr>() && !NewFD->hasAttr<CUDADeviceAttr>() &&
+      !NewFD->hasAttr<CUDAGlobalAttr>()) {
----------------
`constexpr` functions can return `void` in a couple of different ways (in 
C++11, if they're template specializations with dependent return types that 
instantiate to `void`, and in C++14 there is no restriction on `constexpr` 
functions returning `void`).


http://reviews.llvm.org/D18380



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

Reply via email to