================
@@ -6734,8 +6734,10 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, 
SourceLocation LParenLoc,
     // If Arg is declared in the default address space and Param is declared
     // in a non-default address space, perform an implicit address space cast 
to
     // the parameter type.
-    if (getLangOpts().HIP && getLangOpts().CUDAIsDevice && FD &&
-        FD->getBuiltinID()) {
+    FunctionDecl *Caller = getCurFunctionDecl(/*AllowLambda =*/true);
+    bool CallerIsDevice = Caller && (Caller->hasAttr<CUDAGlobalAttr>() ||
+                                     Caller->hasAttr<CUDADeviceAttr>());
+    if (getLangOpts().HIP && CallerIsDevice && FD && FD->getBuiltinID()) {
----------------
jmmartinez wrote:

I've updated the condition and dropped the `CallerIsDevice` side of it.

https://github.com/llvm/llvm-project/pull/165387
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to