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

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 30 07:42:29 PDT 2021


Anastasia added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6150
                     options::OPT_fno_threadsafe_statics,
-                    !IsWindowsMSVC || IsMSVC2015Compatible))
+                    !types::isOpenCL(InputType) &&
+                        (!IsWindowsMSVC || IsMSVC2015Compatible)))
----------------
I think this will work fine apart from if someone creates `.cpp` file but passes `-cl-std=clc++`. But it is not the conventional flow so I think we  should not worry about it for now.


================
Comment at: clang/test/Driver/threadsafe-statics.clcpp:2
+// 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
+
----------------
Worth adding one more RUN line with `-fthreadsafe-statics` passed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107163



More information about the cfe-commits mailing list