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

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 31 17:12:41 PDT 2015


tra added inline comments.

================
Comment at: include/clang/Sema/Sema.h:8599
@@ +8598,3 @@
+    CFP_Never,      // Invalid caller/callee combination.
+    CFP_LastResort, // same as CFP_Never or CFP_Fallback, depending on
+                    // -fcuda-disable-target-call-checks option
----------------
eliben wrote:
> The comment should explain exactly how it depends on the option
Rephrased.

================
Comment at: lib/AST/ItaniumMangle.cpp:504
@@ +503,3 @@
+  if (FD->hasAttr<CUDADeviceAttr>() && FD->hasAttr<CUDAHostAttr>())
+    Out << "Ua6deviceUa4host";
+
----------------
eliben wrote:
> Why device before host?
[[ https://mentorembedded.github.io/cxx-abi/abi.html#mangling-type | Name mangling chapter  ]] in Itanium CXX ABI says:
> In cases where multiple order-insensitive qualifiers are present, they should be ordered [...] with the 'U' qualifiers in alphabetical order by the vendor name

So I've ordered attributes alphabetically.

================
Comment at: lib/Sema/SemaCUDA.cpp:98
@@ +97,3 @@
+  CUDAFunctionTarget CallerTarget =
+                         Caller ? IdentifyCUDATarget(Caller) : Sema::CFT_Host,
+                     CalleeTarget = IdentifyCUDATarget(Callee);
----------------
eliben wrote:
> Why allow Caller to be nullptr but not Callee? Also, != nullptr?
Caller may be null in global context (e.g. we're assigning function address to a global variable). Callee can't be. I'll add an assert().

> Also, != nullptr?

I'm not quite sure what you mean here. Are you suggesting replacing "Caller ?" with "Caller != nullptr ?"





http://reviews.llvm.org/D12453





More information about the cfe-commits mailing list