xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/atomic.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc namespace PR11411 {
4*f4a2713aSLionel Sambuc   template<typename _Tp> struct Ptr {
5*f4a2713aSLionel Sambuc     void f();
6*f4a2713aSLionel Sambuc   };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc   // CHECK-LABEL: define linkonce_odr void @_ZN7PR114113PtrIiE1fEv
9*f4a2713aSLionel Sambuc   // CHECK-NOT: ret
f()10*f4a2713aSLionel Sambuc   template<typename _Tp> inline void Ptr<_Tp>::f() {
11*f4a2713aSLionel Sambuc     int* _refcount;
12*f4a2713aSLionel Sambuc     // CHECK: atomicrmw add i32*
13*f4a2713aSLionel Sambuc     __sync_fetch_and_add(_refcount, 1);
14*f4a2713aSLionel Sambuc     // CHECK-NEXT: ret void
15*f4a2713aSLionel Sambuc   }
f(Ptr<int> * a)16*f4a2713aSLionel Sambuc   void f(Ptr<int> *a) { a->f(); }
17*f4a2713aSLionel Sambuc }
18