82 lines · cpp
1// expected-no-diagnostics2 3//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 \4//RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \5//RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \6//RUN: -ast-print %s | FileCheck %s --check-prefix=PRINT7 8//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 \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 -fopenmp -fopenmp-version=60 \14//RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \15//RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \16//RUN: -emit-pch -o %t %s17 18//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 \19//RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \20//RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \21//RUN: -include-pch %t -ast-print %s | FileCheck %s --check-prefix=PRINT22 23//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 \24//RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \25//RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \26//RUN: -include-pch %t -ast-dump-all %s | FileCheck %s --check-prefix=DUMP27 28#ifndef HEADER29#define HEADER30 31void foo() {32 int a;33#pragma omp target default(firstprivate)34 a++;35 // PRINT: #pragma omp target default(firstprivate)36 // PRINT-NEXT: a++;37 // DUMP: -OMPTargetDirective38 // DUMP-NEXT: -OMPDefaultClause39 // DUMP-NEXT: -OMPFirstprivateClause {{.*}} <implicit>40 // DUMP-NEXT: -DeclRefExpr {{.*}} 'a'41 42}43void fun(){44int a = 0;45 int x = 10;46 #pragma omp target data default(firstprivate) map(a)47 {48 // DUMP: -OMPTargetDataDirective49 // DUMP-NEXT: -OMPDefaultClause50 // DUMP-NEXT: -OMPMapClause51 // DUMP-NEXT: -DeclRefExpr {{.*}} 'a'52 // DUMP-NEXT: -OMPFirstprivateClause {{.*}} <implicit>53 // DUMP-NEXT: -DeclRefExpr {{.*}} 'x'54 55 56 x += 10;57 a += 1;58 }59}60void bar(){61int i = 0;62int j = 0;63int nn = 10;64#pragma omp target default(firstprivate)65#pragma omp teams 66#pragma teams distribute parallel for simd 67 for (j = 0; j < nn; j++ ) {68 for (i = 0; i < nn; i++ ) {69 ;70 }71 }72 73 // PRINT: #pragma omp target default(firstprivate)74 // DUMP: -OMPTargetDirective75 // DUMP-NEXT: -OMPDefaultClause76 // DUMP-NEXT: -OMPFirstprivateClause {{.*}} <implicit>77 // DUMP-NEXT: -DeclRefExpr {{.*}} 'j'78 // DUMP-NEXT: -DeclRefExpr {{.*}} 'nn'79 // DUMP-NEXT: -DeclRefExpr {{.*}} 'i'80}81#endif82