Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / scope_ast_print.cpp
blobc5c3a29738a72b1b83c502c6100386c4d8c1fe95
1 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu\
2 //RUN: -fopenmp -fopenmp-version=51 \
3 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
4 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
5 //RUN: -ast-print %s | FileCheck %s --check-prefix=PRINT
7 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu\
8 //RUN: -fopenmp -fopenmp-version=51 \
9 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
10 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
11 //RUN: -ast-dump %s | FileCheck %s --check-prefix=DUMP
13 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu\
14 //RUN: -fopenmp -fopenmp-version=51 \
15 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
16 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
17 //RUN: -emit-pch -o %t %s
19 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu\
20 //RUN: -fopenmp -fopenmp-version=51 \
21 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
22 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
23 //RUN: -include-pch %t -ast-print %s | FileCheck %s --check-prefix=PRINT
25 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu\
26 //RUN: -fopenmp -fopenmp-version=51 \
27 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
28 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
29 //RUN: -include-pch %t -ast-dump-all %s | FileCheck %s --check-prefix=DUMP
31 #ifndef HEADER
32 #define HEADER
33 int foo1() {
34 int a;
35 int i = 1;
36 #pragma omp scope private(a) reduction(+:i) nowait
38 a = 123;
39 ++i;
41 return i;
44 //DUMP: FunctionDecl {{.*}}foo1 'int ()'
45 //DUMP: OMPScopeDirective
46 //DUMP: OMPPrivateClause
47 //DUMP: DeclRefExpr {{.*}}'int' lvalue Var{{.*}}'a' 'int'
48 //DUMP: OMPReductionClause
49 //DUMP: DeclRefExpr {{.*}}'int' lvalue Var{{.*}}'i' 'int'
50 //DUMP: OMPNowaitClause
51 //PRINT: #pragma omp scope private(a) reduction(+: i) nowait
53 template <typename T>
54 T run() {
55 T a;
56 T b;
58 #pragma omp scope private(a) reduction(*:b)
60 b *= a;
62 return b;
65 int template_test() {
66 double d;
67 d = run<double>();
68 return 0;
71 //DUMP: FunctionTemplateDecl {{.*}}run
72 //DUMP: TemplateTypeParmDecl {{.*}}referenced typename depth 0 index 0 T
73 //DUMP: FunctionDecl {{.*}}run 'T ()'
74 //DUMP: OMPScopeDirective
75 //DUMP: OMPPrivateClause
76 //DUMP: DeclRefExpr {{.*}}'T' lvalue Var {{.*}} 'a' 'T'
77 //DUMP: OMPReductionClause
78 //DUMP: DeclRefExpr {{.*}}'T' lvalue Var {{.*}} 'b' 'T'
79 //DUMP: FunctionDecl {{.*}}used run 'double ()'
80 //DUMP: TemplateArgument type 'double'
81 //DUMP: BuiltinType {{.*}}'double'
82 //DUMP: OMPScopeDirective
83 //DUMP: OMPPrivateClause
84 //DUMP: DeclRefExpr {{.*}}'double' lvalue Var {{.*}} 'a' 'double'
85 //DUMP: OMPReductionClause
86 //DUMP: DeclRefExpr {{.*}}'double' lvalue Var {{.*}} 'b' 'double'
87 //PRINT: #pragma omp scope private(a) reduction(*: b)
88 #endif // HEADER