[PATCH] D18380: [CUDA] Implement -fcuda-relaxed-constexpr, and enable it by default.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 10:58:27 PDT 2016

rsmith added inline comments.

Comment at: include/clang/Driver/CC1Options.td:702-703
@@ -701,2 +701,4 @@
   HelpText<"Allow variadic functions in CUDA device code.">;
+def fcuda_relaxed_constexpr : Flag<["-"], "fcuda-relaxed-constexpr">,
+  HelpText<"Treat constexpr functions as __host__ __device__.">;
Is there a better name we can use for this? I don't think this is "relaxed" in any obvious sense. `-fcuda-host-device-constexpr` or `-fcuda-constexpr-on-device` might be clearer?

Comment at: lib/Driver/Tools.cpp:3597
@@ -3596,2 +3596,3 @@
+    CmdArgs.push_back("-fcuda-relaxed-constexpr");
For flags that are enabled by default, we usually have the -cc1 flag be a `-fno-*` flag. This allows people to use (for instance) `clang blah.cu -Xclang -fno-cuda-relaxed-constexpr` if necessary.

Comment at: lib/Sema/SemaOverload.cpp:1132
@@ -1136,1 +1131,3 @@
+    // one viable function with this signature on any side of CUDA compilation.
+    if ((NewTarget == CFT_Global) || (OldTarget == CFT_Global))
       return false;
No parens around `==` comparisons.


More information about the cfe-commits mailing list