89 lines · cpp
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=PRINT6 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=DUMP12 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 %s18 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=PRINT24 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=DUMP30 31#ifndef HEADER32#define HEADER33int foo1() {34 int a;35 int i = 1;36 #pragma omp scope private(a) reduction(+:i) nowait37 { 38 a = 123; 39 ++i; 40 }41 return i;42}43 44//DUMP: FunctionDecl {{.*}}foo1 'int ()'45//DUMP: OMPScopeDirective46//DUMP: OMPPrivateClause47//DUMP: DeclRefExpr {{.*}}'int' lvalue Var{{.*}}'a' 'int'48//DUMP: OMPReductionClause49//DUMP: DeclRefExpr {{.*}}'int' lvalue Var{{.*}}'i' 'int'50//DUMP: OMPNowaitClause51//PRINT: #pragma omp scope private(a) reduction(+: i) nowait52 53template <typename T>54T 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 65int template_test() {66 double d;67 d = run<double>();68 return 0;69}70 71//DUMP: FunctionTemplateDecl {{.*}}run72//DUMP: TemplateTypeParmDecl {{.*}}referenced typename depth 0 index 0 T73//DUMP: FunctionDecl {{.*}}run 'T ()'74//DUMP: OMPScopeDirective75//DUMP: OMPPrivateClause76//DUMP: DeclRefExpr {{.*}}'T' lvalue Var {{.*}} 'a' 'T'77//DUMP: OMPReductionClause78//DUMP: DeclRefExpr {{.*}}'T' lvalue Var {{.*}} 'b' 'T'79//DUMP: FunctionDecl {{.*}}used run 'double ()'80//DUMP: TemplateArgument type 'double'81//DUMP: BuiltinType {{.*}}'double'82//DUMP: OMPScopeDirective83//DUMP: OMPPrivateClause84//DUMP: DeclRefExpr {{.*}}'double' lvalue Var {{.*}} 'a' 'double'85//DUMP: OMPReductionClause86//DUMP: DeclRefExpr {{.*}}'double' lvalue Var {{.*}} 'b' 'double'87//PRINT: #pragma omp scope private(a) reduction(*: b)88#endif // HEADER89