From 3b9ebe92011b033523217a9b9a2f03f4c8c37aab Mon Sep 17 00:00:00 2001 From: Nick Sarnie Date: Thu, 5 Jun 2025 10:15:38 -0400 Subject: [clang] Simplify device kernel attributes (#137882) We have multiple different attributes in clang representing device kernels for specific targets/languages. Refactor them into one attribute with different spellings to make it more easily scalable for new languages/targets. --------- Signed-off-by: Sarnie, Nick --- clang/lib/CodeGen/CodeGenFunction.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 2ac7e9d..3302abad 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -626,7 +626,7 @@ CodeGenFunction::getUBSanFunctionTypeHash(QualType Ty) const { void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD, llvm::Function *Fn) { - if (!FD->hasAttr() && !FD->hasAttr()) + if (!FD->hasAttr() && !FD->hasAttr()) return; llvm::LLVMContext &Context = getLLVMContext(); @@ -1598,7 +1598,8 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, // Implicit copy-assignment gets the same special treatment as implicit // copy-constructors. emitImplicitAssignmentOperatorBody(Args); - } else if (FD->hasAttr() && + } else if (DeviceKernelAttr::isOpenCLSpelling( + FD->getAttr()) && GD.getKernelReferenceKind() == KernelReferenceKind::Kernel) { CallArgList CallArgs; for (unsigned i = 0; i < Args.size(); ++i) { -- cgit v1.1