OSDN Git Service

[CUDA][HIP] Always defer diagnostics for wrong-sided reference
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Wed, 15 Jul 2020 17:25:32 +0000 (13:25 -0400)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Fri, 17 Jul 2020 11:51:55 +0000 (07:51 -0400)
commit4fc752b30b9acac73a282cb844a6240e6cb70cca
tree93bb9507637dc96795f469e3509f05403a1cfa18
parent9a0689e072da1a60c8b858e829d57d5b1136bd30
[CUDA][HIP] Always defer diagnostics for wrong-sided reference

When a device function calls a host function or vice versa, this is wrong-sided
reference. Currently clang immediately diagnose it. This is different from nvcc
behavior, where it is diagnosed only if the function is really emitted.

Current clang behavior causes false alarms for valid use cases.

This patch let clang always defer diagnostics for wrong-sided
reference.

Differential Revision: https://reviews.llvm.org/D83893
clang/lib/Sema/SemaCUDA.cpp
clang/test/SemaCUDA/builtins.cu
clang/test/SemaCUDA/call-kernel-from-kernel.cu
clang/test/SemaCUDA/function-overload.cu
clang/test/SemaCUDA/function-target.cu
clang/test/SemaCUDA/implicit-device-lambda.cu
clang/test/SemaCUDA/method-target.cu
clang/test/SemaCUDA/reference-to-kernel-fn.cu