aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2020-09-16 15:42:08 -0400
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2020-09-17 11:30:42 -0400
commit40df06cdafc010002fc9cfe1dda73d689b7d27a6 (patch)
treebdf2102638fcb84c0641030d7f797ccf5197a90d /clang/lib/Frontend/CompilerInvocation.cpp
parentd5fd3d9b903ef6d96c6b3b82434dd0461faaba55 (diff)
downloadllvm-40df06cdafc010002fc9cfe1dda73d689b7d27a6.zip
llvm-40df06cdafc010002fc9cfe1dda73d689b7d27a6.tar.gz
llvm-40df06cdafc010002fc9cfe1dda73d689b7d27a6.tar.bz2
[CUDA][HIP] Defer overloading resolution diagnostics for host device functions
In CUDA/HIP a function may become implicit host device function by pragma or constexpr. A host device function is checked in both host and device compilation. However it may be emitted only on host or device side, therefore the diagnostics should be deferred until it is known to be emitted. Currently clang is only able to defer certain diagnostics. This causes false alarms and limits the usefulness of host device functions. This patch lets clang defer all overloading resolution diagnostics for host device functions. An option -fgpu-defer-diag is added to control this behavior. By default it is off. It is NFC for other languages. Differential Revision: https://reviews.llvm.org/D84364
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index a88a911..488a9dd 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2632,6 +2632,9 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
if (Args.hasArg(OPT_fno_cuda_host_device_constexpr))
Opts.CUDAHostDeviceConstexpr = 0;
+ if (Args.hasArg(OPT_fgpu_defer_diag))
+ Opts.GPUDeferDiag = 1;
+
if (Opts.CUDAIsDevice && Args.hasArg(OPT_fcuda_approx_transcendentals))
Opts.CUDADeviceApproxTranscendentals = 1;