[Openmp-commits] [clang] [llvm] [openmp] [OpenMP][clang] Indirect and Virtual function call mapping from host to device (PR #159857)

via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 13 14:58:27 PST 2026


================
@@ -6350,6 +6367,16 @@ void CGOpenMPRuntime::emitTargetOutlinedFunctionHelper(
       [&CGF, &D, &CodeGen](StringRef EntryFnName) {
         const CapturedStmt &CS = *D.getCapturedStmt(OMPD_target);
 
+        // Search Clang AST within "omp target" region for CallExprs.
+        // Store them in the set OMPTargetCalls (kept by CodeGenModule).
+        // This is used for the translation of indirect function calls.
+        const auto &LangOpts = CGF.getLangOpts();
+        if (LangOpts.OpenMPIsTargetDevice) {
+          // Search AST for target "CallExpr"s of "OMPTargetAutoLookup".
+          OMPTargetCallCollector Visitor(CGF.CGM.OMPTargetCalls);
+          Visitor.TraverseStmt(const_cast<Stmt *>(CS.getCapturedStmt()));
----------------
Jason-VanBeusekom wrote:

Updated in [7abe486](https://github.com/llvm/llvm-project/pull/159857/commits/7abe4866545d063d6478351c837d9e76f4684c1f), indirect calls in OMP Target regions are now marked in `SemaOpenMP.cpp` in the ASTcontext.

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


More information about the Openmp-commits mailing list