================ @@ -699,9 +699,20 @@ static RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *FD, bool ConstWithoutErrnoAndExceptions = Context.BuiltinInfo.isConstWithoutErrnoAndExceptions(BuiltinID); // Restrict to target with errno, for example, MacOS doesn't set errno. - // TODO: Support builtin function with complex type returned, eg: cacosh + bool CallWithPointerArgsOrPointerReturnType = false; + if (Call.isScalar() && Call.getScalarVal()) { + if (CallBase *CB = dyn_cast<CallBase>(Call.getScalarVal())) { + for (Value *A : CB->args()) + if (A->getType()->isPointerTy()) + CallWithPointerArgsOrPointerReturnType = true; + CallWithPointerArgsOrPointerReturnType = + CallWithPointerArgsOrPointerReturnType || + CB->getFunctionType()->getReturnType()->isPointerTy(); + } + } ---------------- arsenm wrote:
Turn this into a predicate function https://github.com/llvm/llvm-project/pull/107598 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits