Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_exit_data_ast_print_openmp52.cpp
blobfbc431eadbccb7da14d03859852d21409646e1c3
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
5 // expected-no-diagnostics
7 #ifndef HEADER
8 #define HEADER
10 template <typename T, int C>
11 T tmain(T argc, T *argv) {
12 T i_def, i;
14 i = argc;
15 #pragma omp target exit data map(i_def)
17 #pragma omp target exit data map(from: i)
19 return 0;
22 // CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
23 // CHECK-NEXT: T i_def, i;
24 // CHECK-NEXT: i = argc;
25 // CHECK-NEXT: #pragma omp target exit data map(from: i_def){{$}}
26 // CHECK-NEXT: #pragma omp target exit data map(from: i){{$}}
28 // CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
29 // CHECK-NEXT: int i_def, i;
30 // CHECK-NEXT: i = argc;
31 // CHECK-NEXT: #pragma omp target exit data map(from: i_def)
32 // CHECK-NEXT: #pragma omp target exit data map(from: i)
34 // CHECK: template<> char tmain<char, 1>(char argc, char *argv) {
35 // CHECK-NEXT: char i_def, i;
36 // CHECK-NEXT: i = argc;
37 // CHECK-NEXT: #pragma omp target exit data map(from: i_def)
38 // CHECK-NEXT: #pragma omp target exit data map(from: i)
40 int main (int argc, char **argv) {
41 int b_def, b;
42 static int a_def, a;
43 // CHECK: static int a_def, a;
45 #pragma omp target exit data map(a_def)
46 // CHECK: #pragma omp target exit data map(from: a_def)
47 a_def=2;
48 // CHECK-NEXT: a_def = 2;
50 #pragma omp target exit data map(from: a)
51 // CHECK: #pragma omp target exit data map(from: a)
52 a=2;
53 // CHECK-NEXT: a = 2;
55 #pragma omp target exit data map(b_def)
56 // CHECK-NEXT: #pragma omp target exit data map(from: b_def)
58 #pragma omp target exit data map(from: b)
59 // CHECK-NEXT: #pragma omp target exit data map(from: b)
61 return tmain<int, 5>(argc, &argc) + tmain<char, 1>(argv[0][0], argv[0]);
64 #endif