1 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -x c++ -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4 // expected-no-diagnostics
5 // REQUIRES: x86-registered-target
6 #ifndef HEADER
7 #define HEADER
8 
foo()9 void foo() {}
10 
11 template <class T>
tmain(T argc)12 T tmain(T argc) {
13   static T a;
14 #pragma omp taskwait
15   return a + argc;
16 }
main(int argc,char ** argv)17 int main(int argc, char **argv) {
18 #pragma omp taskwait
19   return tmain(argc);
20 }
21 
22 // CHECK-LABEL: @main
23 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%{{.+}}* @{{.+}})
24 // CHECK: call i32 @__kmpc_omp_taskwait(%{{.+}}* @{{.+}}, i32 [[GTID]])
25 
26 // CHECK-LABEL: tmain
27 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%{{.+}}* @{{.+}})
28 // CHECK: call i32 @__kmpc_omp_taskwait(%{{.+}}* @{{.+}}, i32 [[GTID]])
29 
30 
31 #endif
32