[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGenObjCXX / write-barrier-global-assign.mm
blob869aeda13b15f4242676e650a8013e36bb11e116
1 // RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s
3 @class CPDestUser;
5 CPDestUser* FUNC();
7 // CHECK: {{call.* @objc_assign_global}}
8 CPDestUser* globalUser = FUNC();
10 // CHECK: {{call.* @objc_assign_weak}}
11 __weak CPDestUser* weakUser = FUNC();
14 // CHECK: {{call.* @objc_assign_global}}
15 static CPDestUser* staticUser = FUNC();
17 CPDestUser* GetDestUser()
19 // CHECK: {{call.* @objc_assign_global}}
20         static CPDestUser* gUser = FUNC();
21 // CHECK: {{call.* @objc_assign_weak}}
22         static __weak CPDestUser* wUser = FUNC();
23         if (wUser)
24           return wUser;
25         if (staticUser)
26           return staticUser;
27         return gUser;