| 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: * |
| 4 |
|
| 5 |
// RUN: %clang_cc1 %s -emit-llvm -o - -disable-llvm-optzns | FileCheck %s |
| 6 |
|
| 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} |
| 10 |
|
| 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; |
| 19 |
|
| 20 |
int pthread_create(pthread_t *, const pthread_attr_t *, |
| 21 |
void *(*)(void *), void *); |
| 22 |
//} |
| 23 |
|
| 24 |
const int GlobalVar = 0; |
| 25 |
|
| 26 |
static void *callee0(void *payload) { |
| 27 |
return payload; |
| 28 |
} |
| 29 |
|
| 30 |
static void *callee1(void *payload) { |
| 31 |
return payload; |
| 32 |
} |
| 33 |
|
| 34 |
void foo() { |
| 35 |
pthread_t MyFirstThread; |
| 36 |
pthread_create(&MyFirstThread, 0, callee0, 0); |
| 37 |
|
| 38 |
pthread_t MySecondThread; |
| 39 |
pthread_create(&MySecondThread, 0, callee1, (void *)&GlobalVar); |
| 40 |
} |