================
@@ -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()));
----------------
alexey-bataev wrote:
Why need a const_cast here? Use Const visitor.
Also, not sure a visitor is the best solution here. It may skip lambdas, some
other constants. Better to mark them by a special attribute during sema
analysis, possibly
https://github.com/llvm/llvm-project/pull/159857
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits