[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / callback_pthread_create.c
bloba1f16f3dd9a30eef2d511003288f9a18747c7a6d
1 // FIXME: pthread_create() definition in Builtins.td doesn't match the real one, so it doesn't get recognized as a builtin and attributes aren't added.
2 // RUN: false
3 // XFAIL: *
5 // RUN: %clang_cc1 %s -emit-llvm -o - -disable-llvm-optzns | FileCheck %s
7 // CHECK: declare !callback ![[cid:[0-9]+]] {{.*}}i32 @pthread_create
8 // CHECK: ![[cid]] = !{![[cidb:[0-9]+]]}
9 // CHECK: ![[cidb]] = !{i64 2, i64 3, i1 false}
11 // Taken from test/Analysis/retain-release.m
12 //{
13 struct _opaque_pthread_t {};
14 struct _opaque_pthread_attr_t {};
15 typedef struct _opaque_pthread_t *__darwin_pthread_t;
16 typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t;
17 typedef __darwin_pthread_t pthread_t;
18 typedef __darwin_pthread_attr_t pthread_attr_t;
20 int pthread_create(pthread_t *, const pthread_attr_t *,
21 void *(*)(void *), void *);
22 //}
24 const int GlobalVar = 0;
26 static void *callee0(void *payload) {
27 return payload;
30 static void *callee1(void *payload) {
31 return payload;
34 void foo() {
35 pthread_t MyFirstThread;
36 pthread_create(&MyFirstThread, 0, callee0, 0);
38 pthread_t MySecondThread;
39 pthread_create(&MySecondThread, 0, callee1, (void *)&GlobalVar);