diff options
| author | Justin Lebar <jlebar@google.com> | 2016-04-16 00:11:11 +0000 |
|---|---|---|
| committer | Justin Lebar <jlebar@google.com> | 2016-04-16 00:11:11 +0000 |
| commit | 423019d059897f104c3c435996896df335983b73 (patch) | |
| tree | 6a1c32420960d511b2bae9a738758141eeca7965 /clang/lib/Driver | |
| parent | 4d247e7012ae6355c9b63b6a6549adadd0a16fd1 (diff) | |
| download | bcm5719-llvm-423019d059897f104c3c435996896df335983b73.tar.gz bcm5719-llvm-423019d059897f104c3c435996896df335983b73.zip | |
[CUDA] Raise an error if the CUDA install can't be found.
Summary:
Without this change, we silently proceed on without including
__clang_cuda_runtime_wrapper.h. This leads to very strange behavior --
you say you're compiling CUDA code, but e.g. __device__ is not defined!
Reviewers: tra
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D19180
llvm-svn: 266496
Diffstat (limited to 'clang/lib/Driver')
| -rw-r--r-- | clang/lib/Driver/ToolChains.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 902338b2884..8420fd8fbd6 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -4118,11 +4118,14 @@ void Linux::AddCudaIncludeArgs(const ArgList &DriverArgs, if (DriverArgs.hasArg(options::OPT_nocudainc)) return; - if (CudaInstallation.isValid()) { - addSystemInclude(DriverArgs, CC1Args, CudaInstallation.getIncludePath()); - CC1Args.push_back("-include"); - CC1Args.push_back("__clang_cuda_runtime_wrapper.h"); + if (!CudaInstallation.isValid()) { + getDriver().Diag(diag::err_drv_no_cuda_installation); + return; } + + addSystemInclude(DriverArgs, CC1Args, CudaInstallation.getIncludePath()); + CC1Args.push_back("-include"); + CC1Args.push_back("__clang_cuda_runtime_wrapper.h"); } bool Linux::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); } |

