[clang] [CUDA][HIP] make trivial ctor/dtor host device (PR #72394)
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 15 11:35:33 PST 2023
================
@@ -772,6 +772,26 @@ void Sema::maybeAddCUDAHostDeviceAttrs(FunctionDecl *NewD,
NewD->addAttr(CUDADeviceAttr::CreateImplicit(Context));
}
+// If a trivial ctor/dtor has no host/device
+// attributes, make it implicitly host device function.
+void Sema::maybeAddCUDAHostDeviceAttrsToTrivialCtorDtor(FunctionDecl *FD) {
+ auto IsTrivialCtor = [&](auto *D) {
+ if (auto *CD = dyn_cast<CXXConstructorDecl>(D))
+ return isEmptyCudaConstructor(SourceLocation(), CD);
+ return false;
+ };
+ auto IsTrivialDtor = [&](auto *D) {
+ if (auto *DD = dyn_cast<CXXDestructorDecl>(D))
+ return isEmptyCudaDestructor(SourceLocation(), DD);
+ return false;
+ };
----------------
yxsamliu wrote:
will do
https://github.com/llvm/llvm-project/pull/72394
More information about the cfe-commits
mailing list