[PATCH] D107163: [OpenCL] __cpp_threadsafe_static_init is by default undefined in OpenCL mode

Justas Janickas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 2 06:11:19 PDT 2021


This revision was automatically updated to reflect the committed changes.
Topotuna marked an inline comment as done.
Closed by commit rGb13fc7311eab: [OpenCL] __cpp_threadsafe_static_init is by default undefined in OpenCL mode. (authored by Topotuna).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107163/new/

https://reviews.llvm.org/D107163

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/threadsafe-statics.clcpp


Index: clang/test/Driver/threadsafe-statics.clcpp
===================================================================
--- /dev/null
+++ clang/test/Driver/threadsafe-statics.clcpp
@@ -0,0 +1,11 @@
+// RUN: %clang -### -c -DNO_THREADSAFE_STATICS %s 2>&1 | FileCheck --check-prefix=CHECK-NO-THREADSAFE-STATICS %s
+// RUN: %clang -### -fno-threadsafe-statics -DNO_THREADSAFE_STATICS -c %s 2>&1 | FileCheck --check-prefix=CHECK-NO-THREADSAFE-STATICS %s
+
+// CHECK-NO-THREADSAFE-STATICS: "-cc1"
+// CHECK-NO-THREADSAFE-STATICS: "-fno-threadsafe-statics"
+// CHECK-NO-THREADSAFE-STATICS-NOT: "-fthreadsafe-statics"
+
+// RUN: %clang -### -fthreadsafe-statics -DTHREADSAFE_STATICS -c %s 2>&1 | FileCheck --check-prefix=CHECK-THREADSAFE-STATICS %s
+
+// CHECK-THREADSAFE-STATICS: "-cc1"
+// CHECK-THREADSAFE-STATICS-NOT: "-fno-threadsafe-statics"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6192,7 +6192,8 @@
   // than 19.
   if (!Args.hasFlag(options::OPT_fthreadsafe_statics,
                     options::OPT_fno_threadsafe_statics,
-                    !IsWindowsMSVC || IsMSVC2015Compatible))
+                    !types::isOpenCL(InputType) &&
+                        (!IsWindowsMSVC || IsMSVC2015Compatible)))
     CmdArgs.push_back("-fno-threadsafe-statics");
 
   // -fno-delayed-template-parsing is default, except when targeting MSVC.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107163.363463.patch
Type: text/x-patch
Size: 1497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210802/ff0b43a6/attachment.bin>


More information about the cfe-commits mailing list