https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/121822

>From 92796278b87c5713a0cf16119009c07f87568df5 Mon Sep 17 00:00:00 2001
From: Michael D Toguchi <michael.d.togu...@intel.com>
Date: Mon, 6 Jan 2025 11:42:12 -0800
Subject: [PATCH 1/4] Driver][SYCL] Address sanitizer and test issue

The following commit:
https://github.com/llvm/llvm-project/commit/d00f65c6acd9f0e1ddae83391f55eb9d232d2f9e

Caused sanitizer build issues and also a test issue when using
%clang_cl.  Address these problems.

 - Use local static array
 - Use '--' for clang_cl calls
---
 clang/lib/Driver/ToolChains/SYCL.cpp   | 6 +++---
 clang/lib/Driver/ToolChains/SYCL.h     | 3 ---
 clang/test/Driver/sycl-offload-jit.cpp | 4 ++--
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp 
b/clang/lib/Driver/ToolChains/SYCL.cpp
index e42b65cc07deea..8c39d1b5b2299f 100644
--- a/clang/lib/Driver/ToolChains/SYCL.cpp
+++ b/clang/lib/Driver/ToolChains/SYCL.cpp
@@ -17,8 +17,7 @@ using namespace llvm::opt;
 
 SYCLInstallationDetector::SYCLInstallationDetector(
     const Driver &D, const llvm::Triple &HostTriple,
-    const llvm::opt::ArgList &Args)
-    : D(D) {}
+    const llvm::opt::ArgList &Args) {}
 
 void SYCLInstallationDetector::addSYCLIncludeArgs(
     const ArgList &DriverArgs, ArgStringList &CC1Args) const {
@@ -32,7 +31,7 @@ void SYCLInstallationDetector::addSYCLIncludeArgs(
 
 // Unsupported options for SYCL device compilation.
 static ArrayRef<OptSpecifier> getUnsupportedOpts() {
-  return {
+  static std::vector<OptSpecifier> UnsupportedOpts = {
       options::OPT_fsanitize_EQ,      // -fsanitize
       options::OPT_fcf_protection_EQ, // -fcf-protection
       options::OPT_fprofile_generate,
@@ -54,6 +53,7 @@ static ArrayRef<OptSpecifier> getUnsupportedOpts() {
       options::OPT_forder_file_instrumentation, // -forder-file-instrumentation
       options::OPT_fcs_profile_generate,        // -fcs-profile-generate
       options::OPT_fcs_profile_generate_EQ};
+  return UnsupportedOpts;
 }
 
 SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
diff --git a/clang/lib/Driver/ToolChains/SYCL.h 
b/clang/lib/Driver/ToolChains/SYCL.h
index 9af2fd0c45c5ed..2a8b4eca9e9f82 100644
--- a/clang/lib/Driver/ToolChains/SYCL.h
+++ b/clang/lib/Driver/ToolChains/SYCL.h
@@ -22,9 +22,6 @@ class SYCLInstallationDetector {
 
   void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs,
                           llvm::opt::ArgStringList &CC1Args) const;
-
-private:
-  const Driver &D;
 };
 
 namespace toolchains {
diff --git a/clang/test/Driver/sycl-offload-jit.cpp 
b/clang/test/Driver/sycl-offload-jit.cpp
index d7ab630084098e..ff7e973c6078f5 100644
--- a/clang/test/Driver/sycl-offload-jit.cpp
+++ b/clang/test/Driver/sycl-offload-jit.cpp
@@ -3,7 +3,7 @@
 /// Check the phases graph with -fsycl. Use of -fsycl enables offload
 // RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fsycl %s 
2>&1 \
 // RUN:   | FileCheck -check-prefixes=CHK-PHASES %s
-// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl %s 
2>&1 \
+// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -- 
%s 2>&1 \
 // RUN:   | FileCheck -check-prefixes=CHK-PHASES %s
 // CHK-PHASES: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl)
 // CHK-PHASES-NEXT: 1: preprocessor, {0}, c++-cpp-output, (host-sycl)
@@ -36,7 +36,7 @@
 // RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE %s
 // RUN: %clang_cl -### -fsycl -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s
+// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST -- 
%s
 // RUN: %clang -### -fsycl -fsycl-host-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-HOST %s
 // CHK-FSYCL-IS-DEVICE: "-cc1"{{.*}} "-fsycl-is-device" {{.*}} "-emit-llvm-bc"

>From 79c4b729190d8c5b45d8231e05a1a4adc71f8e21 Mon Sep 17 00:00:00 2001
From: Michael D Toguchi <michael.d.togu...@intel.com>
Date: Mon, 6 Jan 2025 11:50:53 -0800
Subject: [PATCH 2/4] Fix test, put -- on wrong line

---
 clang/test/Driver/sycl-offload-jit.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/test/Driver/sycl-offload-jit.cpp 
b/clang/test/Driver/sycl-offload-jit.cpp
index ff7e973c6078f5..eb192e08a3bc0c 100644
--- a/clang/test/Driver/sycl-offload-jit.cpp
+++ b/clang/test/Driver/sycl-offload-jit.cpp
@@ -35,8 +35,8 @@
 // RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s
 // RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE %s
-// RUN: %clang_cl -### -fsycl -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST -- 
%s
+// RUN: %clang_cl -### -fsycl -c -- %s 2>&1 \
+// RUN:   | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s
 // RUN: %clang -### -fsycl -fsycl-host-only %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FSYCL-IS-HOST %s
 // CHK-FSYCL-IS-DEVICE: "-cc1"{{.*}} "-fsycl-is-device" {{.*}} "-emit-llvm-bc"

>From 5a335369923bdb012625c3c4dd385775e3f04b94 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalyb...@gmail.com>
Date: Mon, 6 Jan 2025 13:14:48 -0800
Subject: [PATCH 3/4] Update SYCL.cpp

---
 clang/lib/Driver/ToolChains/SYCL.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp 
b/clang/lib/Driver/ToolChains/SYCL.cpp
index 8c39d1b5b2299f..acdea5f813728e 100644
--- a/clang/lib/Driver/ToolChains/SYCL.cpp
+++ b/clang/lib/Driver/ToolChains/SYCL.cpp
@@ -31,7 +31,7 @@ void SYCLInstallationDetector::addSYCLIncludeArgs(
 
 // Unsupported options for SYCL device compilation.
 static ArrayRef<OptSpecifier> getUnsupportedOpts() {
-  static std::vector<OptSpecifier> UnsupportedOpts = {
+  static constexpr OptSpecifier UnsupportedOpts[] = {
       options::OPT_fsanitize_EQ,      // -fsanitize
       options::OPT_fcf_protection_EQ, // -fcf-protection
       options::OPT_fprofile_generate,

>From b89faf9bf7237d374cdf92d664fd5c7640618d74 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalyb...@gmail.com>
Date: Mon, 6 Jan 2025 13:31:26 -0800
Subject: [PATCH 4/4] Update SYCL.cpp

---
 clang/lib/Driver/ToolChains/SYCL.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp 
b/clang/lib/Driver/ToolChains/SYCL.cpp
index acdea5f813728e..a2b07ef4824a1b 100644
--- a/clang/lib/Driver/ToolChains/SYCL.cpp
+++ b/clang/lib/Driver/ToolChains/SYCL.cpp
@@ -30,8 +30,8 @@ void SYCLInstallationDetector::addSYCLIncludeArgs(
 }
 
 // Unsupported options for SYCL device compilation.
-static ArrayRef<OptSpecifier> getUnsupportedOpts() {
-  static constexpr OptSpecifier UnsupportedOpts[] = {
+static ArrayRef<options::ID> getUnsupportedOpts() {
+  static constexpr options::ID UnsupportedOpts[] = {
       options::OPT_fsanitize_EQ,      // -fsanitize
       options::OPT_fcf_protection_EQ, // -fcf-protection
       options::OPT_fprofile_generate,
@@ -52,7 +52,8 @@ static ArrayRef<OptSpecifier> getUnsupportedOpts() {
       options::OPT_fprofile_instr_use_EQ,       // -fprofile-instr-use
       options::OPT_forder_file_instrumentation, // -forder-file-instrumentation
       options::OPT_fcs_profile_generate,        // -fcs-profile-generate
-      options::OPT_fcs_profile_generate_EQ};
+      options::OPT_fcs_profile_generate_EQ,
+  };
   return UnsupportedOpts;
 }
 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to