2015-05-20 12:24:19 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
2017-12-30 02:07:07 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
2014-07-21 17:42:05 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
|
|
|
void foo() {}
|
|
|
|
|
2015-12-15 16:19:24 +08:00
|
|
|
// CHECK: template <typename T, int N> int tmain(T argc, char **argv)
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK: static int a;
|
2018-02-15 01:38:47 +08:00
|
|
|
// CHECK-NEXT: #pragma omp critical{{$}}
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: ++a;
|
2018-02-15 01:38:47 +08:00
|
|
|
// CHECK-NEXT: #pragma omp critical (the_name) hint(N){{$}}
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK-NEXT: foo();
|
|
|
|
// CHECK-NEXT: return N;
|
|
|
|
// CHECK: template<> int tmain<int, 4>(int argc, char **argv)
|
2015-12-15 16:19:24 +08:00
|
|
|
template <typename T, int N>
|
|
|
|
int tmain (T argc, char **argv) {
|
|
|
|
T b = argc, c, d, e, f, g;
|
|
|
|
static int a;
|
|
|
|
// CHECK: static int a;
|
|
|
|
#pragma omp critical
|
|
|
|
a=2;
|
|
|
|
// CHECK-NEXT: #pragma omp critical
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: ++a;
|
|
|
|
++a;
|
|
|
|
#pragma omp critical (the_name) hint(N)
|
|
|
|
foo();
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK-NEXT: #pragma omp critical (the_name) hint(4)
|
2015-12-15 16:19:24 +08:00
|
|
|
// CHECK-NEXT: foo();
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK-NEXT: return 4;
|
2015-12-15 16:19:24 +08:00
|
|
|
return N;
|
|
|
|
}
|
|
|
|
|
2014-07-21 17:42:05 +08:00
|
|
|
int main (int argc, char **argv) {
|
|
|
|
int b = argc, c, d, e, f, g;
|
|
|
|
static int a;
|
|
|
|
// CHECK: static int a;
|
|
|
|
#pragma omp critical
|
|
|
|
a=2;
|
|
|
|
// CHECK-NEXT: #pragma omp critical
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: ++a;
|
|
|
|
++a;
|
2015-12-15 16:19:24 +08:00
|
|
|
#pragma omp critical (the_name1) hint(23)
|
2014-07-21 17:42:05 +08:00
|
|
|
foo();
|
2015-12-15 16:19:24 +08:00
|
|
|
// CHECK-NEXT: #pragma omp critical (the_name1) hint(23)
|
2014-07-21 17:42:05 +08:00
|
|
|
// CHECK-NEXT: foo();
|
2015-12-15 16:19:24 +08:00
|
|
|
// CHECK-NEXT: return tmain<int, 4>(a, argv);
|
|
|
|
return tmain<int, 4>(a, argv);
|
2014-07-21 17:42:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|