[PATCH] D12453: [CUDA] Allow function overloads based on host/device attributes.

Eli Bendersky via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 12:26:09 PDT 2015


eliben accepted this revision.
eliben added a comment.
This revision is now accepted and ready to land.

The CUDA parts look very good. Someone else should approve the overloading-related logic


================
Comment at: include/clang/Sema/Sema.h:8605
@@ +8604,3 @@
+
+  CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller,
+                                                const FunctionDecl *Callee);
----------------
Document this function

[I realize the other CUDA functions are not documented here :-(, but hey this is new code so it should follow the rules]

================
Comment at: lib/Sema/SemaCUDA.cpp:98
@@ +97,3 @@
+  assert(Callee && "Callee must be valid.");
+  CUDAFunctionTarget CallerTarget =
+                         Caller ? IdentifyCUDATarget(Caller) : Sema::CFT_Host,
----------------
Yes, I believe this is the accepted style when comparing pointers for null-ness. 

================
Comment at: lib/Sema/SemaCUDA.cpp:106
@@ +105,3 @@
+
+  // (a) Can't call global from global until we support dynamic execution.
+  if (CalleeTarget == CFT_Global &&
----------------
Not just global from global. global from device too, right? As for global from HD, the CUDA guide forbids it

================
Comment at: lib/Sema/SemaChecking.cpp:529
@@ -528,3 +528,3 @@
   // of the arch we are compiling for.
-  if (BuiltinID >= Builtin::FirstTSBuiltin) {
+  if (Context.BuiltinInfo.isTSBuiltin(BuiltinID)) {
     switch (Context.getTargetInfo().getTriple().getArch()) {
----------------
Is this part related to this patch?


http://reviews.llvm.org/D12453





More information about the cfe-commits mailing list