[clang] [CUDA/HIP] Allow implicit __host__ __device__ function redeclarations (PR #214911)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 11:02:03 PDT 2026


jhuber6 wrote:

> Thanks. Could you clarify which libc++ declarations you mean?
>
> I looked at upstream libc++ and did not see explicit `__host__ __device__` annotations on exported ABI functions. Are these from a local experiment, or are they implicit H+D because of `constexpr` / `-foffload-implicit-host-device-templates`?
> 
> That distinction matters here, since this PR is about an explicit H+D declaration followed by a bare redeclaration/definition.

Yes, it was just local experiments, but I figured that it's accepted behavior in `nvcc` for the CUDA language so it might be reasonable to fold into `clang` on its own. The idea was that we can mark things like `_LIBCPP_HIDE_FROM_ABI` with CUDA specific things and inherit them, but this was required because those definitions are strongly redeclared. It's nothing that is an immediate *need* for a custom application, if that's what you're asking.

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


More information about the cfe-commits mailing list