This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Create __host__ and device variants of standard allocator declarations.
ClosedPublic

Authored by tra on Oct 19 2016, 2:36 PM.

Details

Reviewers
jlebar
Summary

Implicit functions are treated as if they were host device and clang does not allow overloading
those with host or device variants.

In order for users to provide their own standard allocators, we must create host and device variants of these declarations during CUDA compilation.

Event Timeline

tra updated this revision to Diff 75229.Oct 19 2016, 2:36 PM
tra retitled this revision from to [CUDA] Create __host__ and device variants of standard allocator declarations..
tra updated this object.
tra added a reviewer: jlebar.
tra added a subscriber: cfe-commits.
jlebar edited edge metadata.Oct 21 2016, 8:59 AM

Is it not possible to write a testcase for this?

jlebar added inline comments.Oct 21 2016, 9:30 AM
lib/Sema/SemaExprCXX.cpp
2596–2601

Nit, no need for empty parens.

2628–2629

I kind of feel like it would be easier to add a boolean parameter to CreateAllocationFunctionDecl, then you don't need to repeat these two lines.

tra updated this revision to Diff 75462.Oct 21 2016, 12:33 PM
tra edited edge metadata.

Addressed jlebar's comments.

jlebar accepted this revision.Oct 21 2016, 12:54 PM
jlebar edited edge metadata.
jlebar added inline comments.
lib/Sema/SemaExprCXX.cpp
2596

Oh, I like this way better than a bool arg.

This revision is now accepted and ready to land.Oct 21 2016, 12:54 PM
tra closed this revision.Dec 6 2016, 4:42 PM

Landed in r284879.