Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / error_ast_print.cpp
blobc6d361b1a3b8b2f82055a630a8f5d99afdbb6f90
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -fopenmp-version=51 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-version=51 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -fopenmp-version=51 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -fopenmp-version=51 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
8 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
13 void foo() {}
14 // CHECK: template <typename T, int N> int tmain(T argc, char **argv)
15 // CHECK: static int a;
16 // CHECK-NEXT: #pragma omp error at(execution) severity(fatal) message("GNU compiler required.")
17 // CHECK-NEXT: a = argv[0][0];
18 // CHECK-NEXT: ++a;
19 // CHECK-NEXT: #pragma omp error at(execution) severity(warning) message("Notice: add for loop.")
20 // CHECK-NEXT: {
21 // CHECK-NEXT: int b = 10;
22 // CHECK-NEXT: T c = 100;
23 // CHECK-NEXT: a = b + c;
24 // CHECK-NEXT: }
25 // CHECK-NEXT: #pragma omp error at(execution) severity(fatal) message("GPU compiler required.")
26 // CHECK-NEXT: foo();
27 // CHECK-NEXT: return N;
29 template <typename T, int N>
30 int tmain(T argc, char **argv) {
31 T b = argc, c, d, e, f, g;
32 static int a;
33 #pragma omp error at(execution) severity(fatal) message("GNU compiler required.")
34 a = argv[0][0];
35 ++a;
36 #pragma omp error at(execution) severity(warning) message("Notice: add for loop.")
38 int b = 10;
39 T c = 100;
40 a = b + c;
42 #pragma omp error at(execution) severity(fatal) message("GPU compiler required.")
43 foo();
44 return N;
47 // CHECK: int main(int argc, char **argv)
48 // CHECK-NEXT: int b = argc, c, d, e, f, g;
49 // CHECK-NEXT: static int a;
50 // CHECK-NEXT: #pragma omp error at(execution) severity(fatal) message("GPU compiler required.")
51 // CHECK-NEXT: a = 2;
52 // CHECK-NEXT: #pragma omp error at(execution) severity(warning) message("Note this is functioncall.")
53 // CHECK-NEXT: foo();
54 int main (int argc, char **argv) {
55 int b = argc, c, d, e, f, g;
56 static int a;
57 #pragma omp error at(execution) severity(fatal) message("GPU compiler required.")
58 a=2;
59 #pragma omp error at(execution) severity(warning) message("Note this is functioncall.")
60 foo();
62 #endif