llvm-project/clang/test/OpenMP/target_update_iterator_serialization.cpp
ShashwathiNavada 9afb651613
Adding support for iterator in motion clauses. (#159112)
As described in section 2.14.6 of openmp spec, the patch implements
support for iterator in motion clauses.

---------

Co-authored-by: Shashwathi N <nshashwa@pe31.hpc.amslabs.hpecorp.net>
2025-12-01 14:03:32 +05:30

36 lines
905 B
C++

// Test without serialization:
// RUN: %clang_cc1 -std=c++20 -fopenmp %s -ast-dump | FileCheck %s
// Test with serialization:
// RUN: %clang_cc1 -std=c++20 -fopenmp -emit-pch -o %t %s
// RUN: %clang_cc1 -x c++ -std=c++20 -fopenmp -include-pch %t -ast-dump-all /dev/null \
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
// RUN: | FileCheck %s
// CHECK: OMPTargetUpdateDirective
// CHECK-NEXT: OMPFromClause
// CHECK-NEXT: ArraySubscriptExpr
// CHECK: DeclRefExpr {{.*}} 'a'
// CHECK: DeclRefExpr {{.*}} 'it'
void foo1() {
int a[10];
#pragma omp target update from(iterator(int it = 0:10) : a[it])
;
}
// CHECK: OMPTargetUpdateDirective
// CHECK-NEXT: OMPToClause
// CHECK-NEXT: ArraySubscriptExpr
// CHECK: DeclRefExpr {{.*}} 'a'
// CHECK: DeclRefExpr {{.*}} 'it'
void foo2() {
int a[10];
#pragma omp target update to(iterator(int it = 0:10) : a[it])
;
}