Clang Project

clang_source_code/test/OpenMP/flush_ast_print.cpp
1// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
2// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
3// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
4
5// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
6// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
7// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
8// expected-no-diagnostics
9
10#ifndef HEADER
11#define HEADER
12
13void foo() {}
14
15template <class T>
16T tmain(T argc) {
17  static T a;
18#pragma omp flush
19#pragma omp flush(a)
20  return a + argc;
21}
22// CHECK:      static T a;
23// CHECK-NEXT: #pragma omp flush{{$}}
24// CHECK-NEXT: #pragma omp flush (a)
25// CHECK:      static int a;
26// CHECK-NEXT: #pragma omp flush
27// CHECK-NEXT: #pragma omp flush (a)
28// CHECK:      static char a;
29// CHECK-NEXT: #pragma omp flush
30// CHECK-NEXT: #pragma omp flush (a)
31
32int main(int argc, char **argv) {
33  static int a;
34// CHECK: static int a;
35#pragma omp flush
36#pragma omp flush(a)
37// CHECK-NEXT: #pragma omp flush
38// CHECK-NEXT: #pragma omp flush (a)
39  return tmain(argc) + tmain(argv[0][0]) + a;
40}
41
42#endif
43