diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp b/clang/lib/Driver/ToolChains/SYCL.cpp index 246bd51acb694..27d8f5fcc4e52 100644 --- a/clang/lib/Driver/ToolChains/SYCL.cpp +++ b/clang/lib/Driver/ToolChains/SYCL.cpp @@ -622,6 +622,12 @@ SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple, // Lookup binaries into the driver directory, this is used to // discover the clang-offload-bundler executable. getProgramPaths().push_back(getDriver().Dir); + + // Diagnose unsupported options only once. + // All sanitizer options are not currently supported. + for (auto A : Args.filtered(options::OPT_fsanitize_EQ)) + D.getDiags().Report(clang::diag::warn_drv_unsupported_option_for_target) + << A->getAsString(Args) << getTriple().str(); } void SYCLToolChain::addClangTargetOptions( @@ -643,6 +649,8 @@ SYCLToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args, // Filter out any options we do not want to pass along to the device // compilation. switch ((options::ID)A->getOption().getID()) { + case options::OPT_fsanitize_EQ: + break; default: DAL->append(A); break; diff --git a/clang/test/Driver/sycl-unsupported.cpp b/clang/test/Driver/sycl-unsupported.cpp new file mode 100644 index 0000000000000..56d44edaa9c26 --- /dev/null +++ b/clang/test/Driver/sycl-unsupported.cpp @@ -0,0 +1,10 @@ +/// Diagnose unsupported options specific to SYCL compilations +// RUN: %clangxx -fsycl -fsanitize=address -### %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix=SANITIZE -DARCH=spir64 +// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -fsanitize=address -### %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix=SANITIZE -DARCH=spir64_gen +// RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga -fsanitize=address -### %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix=SANITIZE -DARCH=spir64_fpga +// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 -fsanitize=address -### %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix=SANITIZE -DARCH=spir64_x86_64 +// SANITIZE: ignoring '-fsanitize=address' option as it is not currently supported for target '[[ARCH]]{{.*}}' [-Woption-ignored]