llvm-project/clang/test/OpenMP/task_transparent_serialization.cpp
Zahira Ammarguellat bde808bf1c
[CLANG][OpenMP] Add support for OpenMP6.0 transparent clause. (#174646)
Add basic parsing and semantic support for transparent clause for task
andtaskloop directives described in Section 17.9.6 of
https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-6-0.pdf
.
2026-01-15 09:48:24 -05:00

119 lines
5.4 KiB
C++

// RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -include-pch %t -ast-dump-all %s | FileCheck %s
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
typedef void **omp_impex_t;
extern const omp_impex_t omp_not_impex;
extern const omp_impex_t omp_import;
extern const omp_impex_t omp_export;
extern const omp_impex_t omp_impex;
template <typename T>
class TransparentTemplate {
public:
void TestTaskLoopImpex() {
#pragma omp taskloop transparent(omp_impex)
for (int i = 0; i < 10; ++i) {}
}
};
void TestTaskTransparent() {
int a;
omp_impex_t imp;
#pragma omp task transparent(omp_not_impex)
#pragma omp task transparent(imp)
#pragma omp parallel
{
#pragma omp task transparent(omp_export)
{
#pragma omp taskloop transparent(omp_impex)
for (int i = 0; i < 5; ++i) {}
}
}
TransparentTemplate<int> obj;
obj.TestTaskLoopImpex();
}
#endif
// CHECK: FunctionDecl {{.*}} TestTaskTransparent 'void ()'
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_not_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: OMPFirstprivateClause
// CHECK-NEXT: DeclRefExpr {{.*}} 'omp_impex_t':'void **' lvalue Var {{.*}} 'imp' 'omp_impex_t':'void **' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'omp_impex_t':'void **' lvalue Var {{.*}} 'imp' 'omp_impex_t':'void **' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_export' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt
// CHECK: OMPTaskLoopDirective
// CHECK-NEXT: OMPTransparentClause
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'omp_impex_t':'void **' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'const omp_impex_t':'void **const' lvalue Var {{.*}} 'omp_impex' 'const omp_impex_t':'void **const'
// CHECK-NEXT: CapturedStmt