[OpenCL] Fix overloading resolution of addrspace constructors
authorOle Strohm <olemarius.strohm@arm.com>
Fri, 11 Jun 2021 09:42:41 +0000 (10:42 +0100)
committerOle Strohm <olemarius.strohm@arm.com>
Fri, 11 Jun 2021 10:12:33 +0000 (11:12 +0100)
commitb102e6880ab06654f945284a520f68c099732f44
tree25d4ed7f7dd37a6044ce9704c2ddcd294334eeb1
parent63042d46bb0c2481a8b7aa1c324405c2720b3603
[OpenCL] Fix overloading resolution of addrspace constructors

This fixes the prioritization of address spaces when choosing a
constructor, stopping them from being considered equally good,
which made the construction of types that could be constructed
by more than one of the constructors.

It does this by preferring the most specific address space,
which is decided by seeing if one of the address spaces is
a superset of the other, and preferring the other.

Fixes: PR50329

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D102850
clang/lib/Sema/SemaOverload.cpp
clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp
clang/test/SemaOpenCLCXX/addrspace-constructors.clcpp