[all-commits] [llvm/llvm-project] 2b76e2: [CUDA][HIP] allow trivial ctor/dtor in device var ...

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Fri Dec 1 13:24:17 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b76e20ea782790a78ec58d5f94ce88a173bab7f
      https://github.com/llvm/llvm-project/commit/2b76e20ea782790a78ec58d5f94ce88a173bab7f
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2023-12-01 (Fri, 01 Dec 2023)

  Changed paths:
    M clang/lib/Sema/SemaCUDA.cpp
    A clang/test/SemaCUDA/trivial-ctor-dtor.cu

  Log Message:
  -----------
  [CUDA][HIP] allow trivial ctor/dtor in device var init (#73140)

Treat ctor/dtor in device var init as host device function
so that they can be used to initialize file-scope
device variables to match nvcc behavior. If they are non-trivial
they will be diagnosed.

We cannot add implicit host device attrs to non-trivial
ctor/dtor since determining whether they are non-trivial
needs to know whether they have a trivial body and all their
member and base classes' ctor/dtor have trivial body, which
is affected by where their bodies are defined or instantiated.

Fixes: #72261

Fixes: SWDEV-432412




More information about the All-commits mailing list