jingyue added inline comments.

================
Comment at: lib/Sema/SemaCUDA.cpp:132-141
@@ -131,12 +131,12 @@
   // (d) HostDevice behavior depends on compilation mode.
   if (CallerTarget == CFT_HostDevice) {
     // Calling a function that matches compilation mode is OK.
     // Calling a function from the other side is frowned upon.
     if (getLangOpts().CUDAIsDevice)
-      return CalleeTarget == CFT_Device ? CFP_Fallback : QuestionableResult;
+      return CalleeTarget == CFT_Device ? CFP_SameSide : QuestionableResult;
     else
       return (CalleeTarget == CFT_Host || CalleeTarget == CFT_Global)
-                 ? CFP_Fallback
+                 ? CFP_SameSide
                  : QuestionableResult;
   }
 
----------------
Maybe a clearer way is to replace QuestionableResult with CFP_WrongSide in this 
if block, and after this if block say

```
if (DisabletargetCallChecks && CFP_WrongSide)
  return CFP_Never;
```

================
Comment at: lib/Sema/SemaOverload.cpp:8544
@@ +8543,3 @@
+        S.IdentifyCUDAPreference(Caller, Cand2.Function);
+    if (((CFP1 == Sema::CFP_SameSide || CFP1 == Sema::CFP_Native) &&
+         (CFP2 <= Sema::CFP_WrongSide)) ||
----------------
Why can't we just return `CFP1>CFP2`? What's a counter example for that? 

================
Comment at: lib/Sema/SemaOverload.cpp:8548
@@ +8547,3 @@
+         (CFP2 == Sema::CFP_SameSide || CFP2 == Sema::CFP_Native)))
+      return CFP1 > CFP2;
+  }
----------------
You assume some numeric orders between these CFPs. May be worth adding a 
comment in CFP's definition. 


http://reviews.llvm.org/D16870



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

Reply via email to