[clang] [OpenMP] Add variable capture support for transparent clause expression. (PR #185419)

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 12 03:56:50 PDT 2026


================
@@ -39,78 +41,132 @@ void TestTaskTransparent() {
 }
 #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: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' 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: OMPFirstprivateClause
+// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'a' 'int' refers_to_enclosing_variable_or_capture
----------------
zahiraam wrote:

That's because there is a reference to `a` in the next directive. I have added some tests to show that it's correct.

https://github.com/llvm/llvm-project/pull/185419


More information about the cfe-commits mailing list