This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Add generic addr space to the return of implicit assignment
ClosedPublic

Authored by Anastasia on Jan 23 2019, 8:47 AM.

Details

Summary

When creating the prototype of implicit assignment operators the returned reference to the class should be qualified with the same addr space as 'this' (i.e. __generic in OpenCL).

Diff Detail

Repository
rL LLVM

Event Timeline

Anastasia updated this revision to Diff 183108.EditedJan 23 2019, 8:47 AM
Anastasia created this revision.
  • Minor update to the comment.

What? No, the l-value should still be qualified like the pointee type. An l-value-to-r-value conversion should remove the qualifier, but not just a dereference.

Anastasia updated this revision to Diff 184052.Jan 29 2019, 3:12 AM
Anastasia retitled this revision from [AST] Fix addr space of result type for dereference operator to [OpenCL] Add generic addr space to the return of implicit assingment .
Anastasia edited the summary of this revision. (Show Details)

The original patch was totally wrong. This was simply the problem of incorrectly creating the prototype for implicit assignment. Specifically we missed qualifying the result type with an address space in the declaration while in the definition we were returning *this that was qualified by __generic.

Example - correct prototype of copy assignment operator is:

__generic C &(const __generic C &) __generic noexcept

but we used to create:

C &(const __generic C &) __generic noexcept

forgetting the address space.

I also improved tests to cover this better.

Anastasia retitled this revision from [OpenCL] Add generic addr space to the return of implicit assingment to [OpenCL] Add generic addr space to the return of implicit assignment .Jan 29 2019, 3:39 AM
rjmccall accepted this revision.Jan 29 2019, 8:57 AM

LGTM.

This revision is now accepted and ready to land.Jan 29 2019, 8:57 AM
This revision was automatically updated to reflect the committed changes.