llvm-project/clang/test/SemaCUDA
Yaxun (Sam) Liu acb6f80d96 [CUDA][HIP] Fix overloading resolution
This patch implements correct hostness based overloading resolution
in isBetterOverloadCandidate.

Based on hostness, if one candidate is emittable whereas the other
candidate is not emittable, the emittable candidate is better.

If both candidates are emittable, or neither is emittable based on hostness, then
other rules should be used to determine which is better. This is because
hostness based overloading resolution is mostly for determining
viability of a function. If two functions are both viable, other factors
should take precedence in preference.

If other rules cannot determine which is better, CUDA preference will be
used again to determine which is better.

However, correct hostness based overloading resolution
requires overloading resolution diagnostics to be deferred,
which is not on by default. The rationale is that deferring
overloading resolution diagnostics may hide overloading reslolutions
issues in header files.

An option -fgpu-exclude-wrong-side-overloads is added, which is off by
default.

When -fgpu-exclude-wrong-side-overloads is off, keep the original behavior,
that is, exclude wrong side overloads only if there are same side overloads.
This may result in incorrect overloading resolution when there are no
same side candates, but is sufficient for most CUDA/HIP applications.

When -fgpu-exclude-wrong-side-overloads is on, enable deferring
overloading resolution diagnostics and enable correct hostness
based overloading resolution, i.e., always exclude wrong side overloads.

Differential Revision: https://reviews.llvm.org/D80450
2020-12-02 16:33:33 -05:00
..
Inputs [CUDA][HIP] Let lambda be host device by default 2020-07-08 13:10:26 -04:00
add-inline-in-definition.cu
addr-of-overloaded-fn.cu
alias.cu
amdgpu-attrs.cu [AMDGPU] Allow using integral non-type template parameters 2019-02-26 18:49:36 +00:00
amdgpu-f128.cu [hip] Claim builtin type `__float128` supported if the host target supports it. 2020-04-21 15:56:40 -04:00
amdgpu-size_t.cu
amdgpu-windows-vectorcall.cu [CUDA][HIP] Check calling convention based on function target 2019-02-26 22:24:49 +00:00
asm-constraints-device.cu
asm-constraints-mixed.cu
asm_delayed_diags.cu [OPENMP][CUDA]Do not emit warnings for variables in late-reported asm 2019-02-26 21:51:16 +00:00
attr-declspec.cu [cuda][hip] Add CUDA builtin surface/texture reference support. 2020-03-27 17:18:49 -04:00
attributes-on-non-cuda.cu [cuda][hip] Add CUDA builtin surface/texture reference support. 2020-03-27 17:18:49 -04:00
autoret-global.cu [CUDA][HIP] Enable kernel function return type deduction. 2019-09-25 16:51:45 +00:00
bad-attributes.cu [CUDA] Allow local static variables with target attributes. 2020-11-03 10:30:38 -08:00
bad-calls-on-same-line.cu recommit 1b978ddba0 [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese 2020-03-23 12:09:07 -04:00
builtins.cu recommit 4fc752b30b [CUDA][HIP] Always defer diagnostics for wrong-sided reference 2020-07-17 09:14:39 -04:00
call-device-fn-from-host.cu recommit 1b978ddba0 [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese 2020-03-23 12:09:07 -04:00
call-host-fn-from-device.cu recommit 1b978ddba0 [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese 2020-03-23 12:09:07 -04:00
call-kernel-from-kernel.cu recommit 4fc752b30b [CUDA][HIP] Always defer diagnostics for wrong-sided reference 2020-07-17 09:14:39 -04:00
call-stack-for-deferred-err.cu
config-type.cu [CUDA] add support for the new kernel launch API in CUDA-9.2+. 2019-01-31 21:34:03 +00:00
constexpr-ctor.cu [CUDA][HIP} Add a test for constexpr default ctor 2019-10-11 02:43:28 +00:00
constexpr-variables.cu PR47805: Use a single object for a function parameter in the caller and 2020-10-14 17:43:51 -07:00
cuda-builtin-vars.cu
cuda-inherits-calling-conv.cu Renamed and changed the wording of warn_cconv_ignored 2019-07-17 20:41:26 +00:00
cxx11-kernel-call.cu
default-ctor.cu [CUDA][HIP] Fix hostness of defaulted constructor 2019-09-20 14:28:09 +00:00
deferred-diags-limit.cu Speed up deferred diagnostic emitter 2020-04-06 13:07:43 -04:00
deferred-diags.cu Speed up deferred diagnostic emitter 2020-04-06 13:07:43 -04:00
deferred-oeverload.cu [CUDA][HIP] Fix overloading resolution 2020-12-02 16:33:33 -05:00
device-use-host-var.cu [CUDA][HIP] Diagnose reference of host variable 2020-12-02 10:15:56 -05:00
device-var-init.cu [CUDA] Allow local static variables with target attributes. 2020-11-03 10:30:38 -08:00
error-includes-mode.cu
exceptions.cu
extern-shared.cu
float16.cu
function-overload.cu [CUDA][HIP] Fix overloading resolution 2020-12-02 16:33:33 -05:00
function-target.cu recommit 4fc752b30b [CUDA][HIP] Always defer diagnostics for wrong-sided reference 2020-07-17 09:14:39 -04:00
function-template-overload.cu
global-initializers-host.cu
gnu-inline.cu [clang] [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode 2019-09-27 12:25:19 +00:00
host-device-constexpr.cu [CUDA][HIP] Fix host/device check with -fopenmp 2019-10-09 23:54:10 +00:00
implicit-copy.cu
implicit-device-lambda.cu recommit 4fc752b30b [CUDA][HIP] Always defer diagnostics for wrong-sided reference 2020-07-17 09:14:39 -04:00
implicit-intrinsic.cu
implicit-member-target-collision-cxx11.cu [CUDA][HIP] Re-apply part of r372318. 2019-09-19 21:26:18 +00:00
implicit-member-target-collision.cu
implicit-member-target-inherited.cu
implicit-member-target.cu
inherited-ctor.cu
kernel-call.cu
lambda.cu [CUDA][HIP] Let lambda be host device by default 2020-07-08 13:10:26 -04:00
launch_bounds.cu
lit.local.cfg
method-target.cu recommit 4fc752b30b [CUDA][HIP] Always defer diagnostics for wrong-sided reference 2020-07-17 09:14:39 -04:00
no-call-stack-for-immediate-errs.cu
no-destructor-overload.cu
no-host-device-constexpr.cu
openmp-static-func.cu [CUDA][HIP] Fix host/device check with -fopenmp 2019-10-09 23:54:10 +00:00
openmp-target.cu recommit 1b978ddba0 [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese 2020-03-23 12:09:07 -04:00
overloaded-delete.cu
pr27778.cu
qualifiers.cu
reference-to-kernel-fn.cu recommit 4fc752b30b [CUDA][HIP] Always defer diagnostics for wrong-sided reference 2020-07-17 09:14:39 -04:00
trace-through-global.cu recommit 1b978ddba0 [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese 2020-03-23 12:09:07 -04:00
union-init.cu [CUDA][HIP] Fix empty ctor/dtor check for union 2020-05-04 21:52:04 -04:00
usual-deallocators.cu
vararg.cu
vla.cu [OPENMP] Delayed diagnostics for VLA support. 2019-02-22 20:36:10 +00:00