llvm-project/clang/test/SemaCUDA
Yaxun (Sam) Liu 049d860707 [CUDA][HIP] Fix constexpr variables for C++17
constexpr variables are compile time constants and implicitly const, therefore
they are safe to emit on both device and host side. Besides, in many cases
they are intended for both device and host, therefore it makes sense
to emit them on both device and host sides if necessary.

In most cases constexpr variables are used as rvalue and the variables
themselves do not need to be emitted. However if their address is taken,
then they need to be emitted.

For C++14, clang is able to handle that since clang emits them with
available_externally linkage together with the initializer.

However for C++17, the constexpr static data member of a class or template class
become inline variables implicitly. Therefore they become definitions with
linkonce_odr or weak_odr linkages. As such, they can not have available_externally
linkage.

This patch fixes that by adding implicit constant attribute to
file scope constexpr variables and constexpr static data members
in device compilation.

Differential Revision: https://reviews.llvm.org/D79237
2020-06-03 21:56:52 -04:00
..
Inputs
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][hip] Add CUDA builtin surface/texture reference support. 2020-03-27 17:18:49 -04: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
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 [OpenCL][CUDA][HIP][SYCL] Add norecurse 2020-02-16 20:41:00 -05:00
call-stack-for-deferred-err.cu
config-type.cu
constexpr-ctor.cu [CUDA][HIP} Add a test for constexpr default ctor 2019-10-11 02:43:28 +00:00
constexpr-variables.cu [CUDA][HIP] Fix constexpr variables for C++17 2020-06-03 21:56:52 -04: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
device-var-init.cu
error-includes-mode.cu
exceptions.cu
extern-shared.cu
float16.cu
function-overload.cu Revert "[CUDA][HIP] Workaround for resolving host device function against wrong-sided function" 2020-05-18 12:22:55 -07:00
function-target.cu
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
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
launch_bounds.cu
lit.local.cfg
method-target.cu
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
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