brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · a1f16f3 Raw
41 lines · c
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: false3// XFAIL: *4 5// RUN: %clang_cc1 %s -emit-llvm -o - -disable-llvm-optzns | FileCheck %s6 7// CHECK: declare !callback ![[cid:[0-9]+]] {{.*}}i32 @pthread_create8// CHECK: ![[cid]] = !{![[cidb:[0-9]+]]}9// CHECK: ![[cidb]] = !{i64 2, i64 3, i1 false}10 11// Taken from test/Analysis/retain-release.m12//{13struct _opaque_pthread_t {};14struct _opaque_pthread_attr_t {};15typedef struct _opaque_pthread_t *__darwin_pthread_t;16typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t;17typedef __darwin_pthread_t pthread_t;18typedef __darwin_pthread_attr_t pthread_attr_t;19 20int pthread_create(pthread_t *, const pthread_attr_t *,21                   void *(*)(void *), void *);22//}23 24const int GlobalVar = 0;25 26static void *callee0(void *payload) {27  return payload;28}29 30static void *callee1(void *payload) {31  return payload;32}33 34void 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}41