forked from OSchip/llvm-project
[CUDA] Don't try to run sanitizers on NVPTX.
Summary: Sanitizers aren't supported on NVPTX -- don't try to run them. This lets you e.g. pass -fsanitize=address and get asan on your host code. Reviewers: kcc Subscribers: cfe-commits, tra, jhen Differential Revision: https://reviews.llvm.org/D24640 llvm-svn: 281680
This commit is contained in:
parent
4dd6b50f6e
commit
6efbc73c25
|
@ -608,6 +608,12 @@ static void addIncludeLinkerOption(const ToolChain &TC,
|
|||
void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
|
||||
llvm::opt::ArgStringList &CmdArgs,
|
||||
types::ID InputType) const {
|
||||
// NVPTX doesn't currently support sanitizers. Bailing out here means that
|
||||
// e.g. -fsanitize=address applies only to host code, which is what we want
|
||||
// for now.
|
||||
if (TC.getTriple().isNVPTX())
|
||||
return;
|
||||
|
||||
// Translate available CoverageFeatures to corresponding clang-cc1 flags.
|
||||
// Do it even if Sanitizers.empty() since some forms of coverage don't require
|
||||
// sanitizers.
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// Check that -fsanitize=foo doesn't get passed down to device-side
|
||||
// compilation.
|
||||
//
|
||||
// REQUIRES: clang-driver
|
||||
//
|
||||
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 -fsanitize=address %s 2>&1 | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
// CHECK-DAG: "-fcuda-is-device"
|
||||
// CHECK-NOT: "-fsanitize=address"
|
||||
// CHECK-DAG: "-triple" "x86_64--linux-gnu"
|
||||
// CHECK: "-fsanitize=address"
|
Loading…
Reference in New Issue