summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/threadsafe-statics.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-06 23:23:06 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-06 23:23:06 +0000
commita508b7de6c5246ab04ed69d0ab4e9977ec1fb4d4 (patch)
tree9b5b83fb4a534e2d2decf51f1af85d1a68dae007 /test/CodeGenCXX/threadsafe-statics.cpp
parent594d5e8bd9870080aad6a761538e272bc2dfcc13 (diff)
Add support for threadsafe statics, and make them the default (matching gcc).
Daniel, I'd appreciate a review of the driver/cc1 parts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95508 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/threadsafe-statics.cpp')
-rw-r--r--test/CodeGenCXX/threadsafe-statics.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/CodeGenCXX/threadsafe-statics.cpp b/test/CodeGenCXX/threadsafe-statics.cpp
new file mode 100644
index 0000000000..65ebc43c5d
--- /dev/null
+++ b/test/CodeGenCXX/threadsafe-statics.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck -check-prefix=WITH-TSS %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fno-threadsafe-statics | FileCheck -check-prefix=NO-TSS %s
+
+int f();
+
+// WITH-TSS: define void @_Z1gv() nounwind
+// WITH-TSS: call i32 @__cxa_guard_acquire
+// WITH-TSS: call void @__cxa_guard_release
+// WITH-TSS: ret void
+void g() {
+ static int a = f();
+}
+
+// NO-TSS: define void @_Z1gv() nounwind
+// NO-TSS-NOT: call i32 @__cxa_guard_acquire
+// NO-TSS-NOT: call void @__cxa_guard_release
+// NO-TSS: ret void