[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -12926,6 +12929,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { // FIXME: Functions declared with SYCL_EXTERNAL are required during // device compilation. tahonermann wrote: ```suggestion ``` https://github.com/llvm/llvm-project/pull/140

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -1545,6 +1550,18 @@ def SYCLKernel : InheritableAttr { let Documentation = [SYCLKernelDocs]; } +def GlobalStorageNonLocalVar : SubsetSubjecthasGlobalStorage() && + !S->isLocalVarDeclOrParm()}], +

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -1545,6 +1550,18 @@ def SYCLKernel : InheritableAttr { let Documentation = [SYCLKernelDocs]; } +def GlobalStorageNonLocalVar : SubsetSubjecthasGlobalStorage() && + !S->isLocalVarDeclOrParm()}], +

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -408,10 +408,14 @@ class SubjectList subjects, SubjectDiag diag = WarnDiag, string CustomDiag = customDiag; } -class LangOpt { +class LangOpt { // The language option to test; ignored when custom code is supplied. string Name = name; + // If set to 1, the attrib

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,52 @@ +// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify -DSYCL %s +// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -verify -DHOST %s tahonermann wrote: Since SYCL applies to both host and device, let's differentiate by "host" and "device" (wi

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -12909,6 +12909,9 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { if (D->hasAttr()) return false; + if (LangOpts.SYCLIsDevice && !D->hasAttr()) +return false; tahonermann wrote: This will also need to check for the new `SYCLExternalAttr`

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,52 @@ +// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify -DSYCL %s +// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -verify -DHOST %s +// RUN: %clang_cc1 -verify %s + +// Semantic tests for sycl_external attribute + +#ifdef SYCL + +__attribute__((sycl_external(3

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann requested changes to this pull request. Thanks for working on this @schittir! I completed an initial pass of all of the code, but still need to look more closely at the documentation updates. https://github.com/llvm/llvm-project/pull/140282 ___

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -100,11 +100,10 @@ int main() { // Verify that SYCL kernel caller functions are emitted for each device target. // -// FIXME: The following set of matches are used to skip over the declaration of -// main(). main() shouldn't be emitted in device code, but that pruning isn't

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -12926,6 +12929,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { // FIXME: Functions declared with SYCL_EXTERNAL are required during // device compilation. +// Functions definitions with sycl_external attribute are required during +// device compila

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -12746,6 +12746,11 @@ def err_sycl_special_type_num_init_method : Error< "types with 'sycl_special_class' attribute must have one and only one '__init' " "method defined">; +//SYCL external attribute diagnostics +def err_sycl_attribute_internal_decl +: Error<"%0 at

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
@@ -62,6 +62,7 @@ class SemaSYCL : public SemaBase { ParsedType ParsedTy); void handleKernelAttr(Decl *D, const ParsedAttr &AL); + void handleSYCLExternalAttr(Decl *D, const ParsedAttr &AL); tahonermann wrote: Since t

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann edited https://github.com/llvm/llvm-project/pull/140282 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread via cfe-commits
https://github.com/schittir updated https://github.com/llvm/llvm-project/pull/140282 >From abdbf8905d324f9b935b34bbc97c508ede5ac028 Mon Sep 17 00:00:00 2001 From: "Chittireddy, Sindhu" Date: Fri, 16 May 2025 08:51:06 -0700 Subject: [PATCH 1/2] Add sycl_external attribute --- clang/include/cla

[clang] Add sycl_external attribute (PR #140282)

2025-05-16 Thread via cfe-commits
https://github.com/schittir created https://github.com/llvm/llvm-project/pull/140282 None >From abdbf8905d324f9b935b34bbc97c508ede5ac028 Mon Sep 17 00:00:00 2001 From: "Chittireddy, Sindhu" Date: Fri, 16 May 2025 08:51:06 -0700 Subject: [PATCH] Add sycl_external attribute --- clang/include/c