| 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 |
| 6 |
|
| 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 |
| 12 |
|
| 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 |
| 18 |
|
| 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 |
| 24 |
|
| 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 |
| 30 |
|
| 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 |
| 37 |
{ |
| 38 |
a = 123; |
| 39 |
++i; |
| 40 |
} |
| 41 |
return i; |
| 42 |
} |
| 43 |
|
| 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 |
| 52 |
|
| 53 |
template <typename T> |
| 54 |
T run() { |
| 55 |
T a; |
| 56 |
T b; |
| 57 |
|
| 58 |
#pragma omp scope private(a) reduction(*:b) |
| 59 |
{ |
| 60 |
b *= a; |
| 61 |
} |
| 62 |
return b; |
| 63 |
} |
| 64 |
|
| 65 |
int template_test() { |
| 66 |
double d; |
| 67 |
d = run<double>(); |
| 68 |
return 0; |
| 69 |
} |
| 70 |
|
| 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 |