r283121 - [CUDA] Clean up some comments in Sema::IsOverload. NFC

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 09:48:28 PDT 2016


Author: jlebar
Date: Mon Oct  3 11:48:27 2016
New Revision: 283121

URL: http://llvm.org/viewvc/llvm-project?rev=283121&view=rev
Log:
[CUDA] Clean up some comments in Sema::IsOverload.  NFC

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=283121&r1=283120&r2=283121&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Oct  3 11:48:27 2016
@@ -1141,17 +1141,17 @@ bool Sema::IsOverload(FunctionDecl *New,
 
     assert((OldTarget != CFT_InvalidTarget) && "Unexpected invalid target.");
 
-    // Don't allow mixing of HD with other kinds. This guarantees that
-    // we have only one viable function with this signature on any
-    // side of CUDA compilation .
-    // __global__ functions can't be overloaded based on attribute
-    // difference because, like HD, they also exist on both sides.
+    // Don't allow HD and global functions to overload other functions with the
+    // same signature.  We allow overloading based on CUDA attributes so that
+    // functions can have different implementations on the host and device, but
+    // HD/global functions "exist" in some sense on both the host and device, so
+    // should have the same implementation on both sides.
     if ((NewTarget == CFT_HostDevice) || (OldTarget == CFT_HostDevice) ||
         (NewTarget == CFT_Global) || (OldTarget == CFT_Global))
       return false;
 
-    // Allow overloading of functions with same signature, but
-    // different CUDA target attributes.
+    // Allow overloading of functions with same signature and different CUDA
+    // target attributes.
     return NewTarget != OldTarget;
   }
 




More information about the cfe-commits mailing list