[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
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 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
@@ -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
@@ -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
@@ -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] [libcxx] [llvm] [Clang] Add warnings when mixing different charN_t types (PR #138708)

2025-05-14 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,155 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -std=c++20 -Wconversion %s + +void c8(char8_t); +void c16(char16_t); +void c32(char32_t); + +void test(char8_t u8, char16_t u16, char32_t u32) { +c8(u8); +c8(u16); // expected-warning {{implicit conversion from 'c

[clang] [cmake] Refactor clang unittest cmake (PR #133545)

2025-05-20 Thread Tom Honermann via cfe-commits
tahonermann wrote: I ended up spending a lot of time barking down the wrong rabbit hole due to these changes. @rnk, please see https://github.com/llvm/llvm-project/issues/140799. https://github.com/llvm/llvm-project/pull/133545 ___ cfe-commits mailin

[clang] [clang] Merge gtest binaries into AllClangUnitTests (PR #134196)

2025-05-20 Thread Tom Honermann via cfe-commits
tahonermann wrote: I ended up spending a lot of time barking down the wrong rabbit hole due to these changes. @rnk, please see https://github.com/llvm/llvm-project/issues/140799. https://github.com/llvm/llvm-project/pull/134196 ___ cfe-commits mailin

[clang] [SYCL] SYCL host kernel launch support for the sycl_kernel_entry_point attribute. (PR #152403)

2025-08-08 Thread Tom Honermann via cfe-commits
@@ -367,6 +370,67 @@ void SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) { namespace { +CompoundStmt *BuildSYCLKernelLaunchStmt(Sema &SemaRef, FunctionDecl *FD, +const std::string &KernelName) { + ASTContext &Ctx = SemaRe

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-07 Thread Tom Honermann via cfe-commits
@@ -4084,6 +4084,19 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S, diag::note_carries_dependency_missing_first_decl) << 0/*Function*/; } +// SYCL 2020 section 5.10.1, "SYCL functions and member functions linkage": +// W

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-07 Thread Tom Honermann via cfe-commits
@@ -12251,6 +12264,9 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, if (NewFD->hasAttr()) SYCL().CheckSYCLEntryPointFunctionDecl(NewFD); + if (NewFD->hasAttr()) +SYCL().CheckSYCLExternalFunctionDecl(NewFD); tahonermann wrote:

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-07 Thread Tom Honermann via cfe-commits
@@ -12251,6 +12264,9 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, if (NewFD->hasAttr()) SYCL().CheckSYCLEntryPointFunctionDecl(NewFD); + if (NewFD->hasAttr()) +SYCL().CheckSYCLExternalFunctionDecl(NewFD); tahonermann wrote:

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,77 @@ +// RUN: %clang_cc1 -fsycl-is-device -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s + +// This test code generation when sycl_external attribute is used + +// Function defined and not used - symbols emitted +[[clang::sycl_ex

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -12251,6 +12264,9 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, if (NewFD->hasAttr()) SYCL().CheckSYCLEntryPointFunctionDecl(NewFD); + if (NewFD->hasAttr()) +SYCL().CheckSYCLExternalFunctionDecl(NewFD); tahonermann wrote:

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -4084,6 +4084,19 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S, diag::note_carries_dependency_missing_first_decl) << 0/*Function*/; } +// SYCL 2020 section 5.10.1, "SYCL functions and member functions linkage": +// W

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,77 @@ +// RUN: %clang_cc1 -fsycl-is-device -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s + +// This test code generation when sycl_external attribute is used + +// Function defined and not used - symbols emitted +[[clang::sycl_ex

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,157 @@ +// RUN: %clang_cc1 -fsycl-is-host -std=c++17 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsycl-is-device -std=c++17 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsycl-is-host -std=c++20 -fsyntax-only -verify -DCPP20 %s +// RUN: %clang_cc1 -fsycl-is-device -st

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann requested changes to this pull request. Suggestions to address the diagnostic issues with explicit and implicit template instantiations as well as a couple of additional tests. https://github.com/llvm/llvm-project/pull/140282 __

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 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] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,78 @@ +// RUN: %clang_cc1 -fsycl-is-device -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s + +// This test code generation when sycl_external attribute is used + +// Function defined and not used - symbols emitted +[[clang::sycl_ex

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,157 @@ +// RUN: %clang_cc1 -fsycl-is-host -std=c++17 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsycl-is-device -std=c++17 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsycl-is-host -std=c++20 -fsyntax-only -verify -DCPP20 %s +// RUN: %clang_cc1 -fsycl-is-device -st

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,78 @@ +// RUN: %clang_cc1 -fsycl-is-device -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s + +// This test code generation when sycl_external attribute is used + +// Function defined and not used - symbols emitted +[[clang::sycl_ex

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -250,6 +250,20 @@ static bool CheckSYCLKernelName(Sema &S, SourceLocation Loc, return false; } +void SemaSYCL::CheckSYCLExternalFunctionDecl(FunctionDecl *FD) { + const auto *SEAttr = FD->getAttr(); + assert(SEAttr && "Missing sycl_external attribute"); + if (!FD->isE

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-13 Thread Tom Honermann via cfe-commits
@@ -0,0 +1,157 @@ +// RUN: %clang_cc1 -fsycl-is-host -std=c++17 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsycl-is-device -std=c++17 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsycl-is-host -std=c++20 -fsyntax-only -verify -DCPP20 %s +// RUN: %clang_cc1 -fsycl-is-device -st

[clang] [SYCL] SYCL host kernel launch support for the sycl_kernel_entry_point attribute. (PR #152403)

2025-08-16 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann updated https://github.com/llvm/llvm-project/pull/152403 >From 5b42f6b9470a96a79b3474fcf384fa950449e095 Mon Sep 17 00:00:00 2001 From: Tom Honermann Date: Wed, 6 Aug 2025 19:26:54 -0700 Subject: [PATCH 1/2] [SYCL] SYCL host kernel launch support for the sycl_kern

[clang] [SYCL] SYCL host kernel launch support for the sycl_kernel_entry_point attribute. (PR #152403)

2025-08-17 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann updated https://github.com/llvm/llvm-project/pull/152403 >From 5b42f6b9470a96a79b3474fcf384fa950449e095 Mon Sep 17 00:00:00 2001 From: Tom Honermann Date: Wed, 6 Aug 2025 19:26:54 -0700 Subject: [PATCH 1/4] [SYCL] SYCL host kernel launch support for the sycl_kern

[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)

2025-08-15 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann approved this pull request. Thank you, @schittir, for all your hard work on this! It looks great! @erichkeane, @bader, please review at your earliest convenience! https://github.com/llvm/llvm-project/pull/140282 ___ cfe-

[clang] [NFC][SYCL] Test use of sycl_kernel_entry_point with null declarations and statements. (PR #154583)

2025-08-21 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann closed https://github.com/llvm/llvm-project/pull/154583 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [SYCL] SYCL host kernel launch support for the sycl_kernel_entry_point attribute. (PR #152403)

2025-08-16 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann updated https://github.com/llvm/llvm-project/pull/152403 >From 5b42f6b9470a96a79b3474fcf384fa950449e095 Mon Sep 17 00:00:00 2001 From: Tom Honermann Date: Wed, 6 Aug 2025 19:26:54 -0700 Subject: [PATCH 1/3] [SYCL] SYCL host kernel launch support for the sycl_kern

[clang] [SYCL] SYCL host kernel launch support for the sycl_kernel_entry_point attribute. (PR #152403)

2025-08-16 Thread Tom Honermann via cfe-commits
@@ -410,6 +474,36 @@ class OutlinedFunctionDeclBodyInstantiator ParmDeclMap &MapRef; }; +OutlinedFunctionDecl *BuildSYCLKernelEntryPointOutline(Sema &SemaRef, + FunctionDecl *FD, +

[clang] [SYCL] SYCL host kernel launch support for the sycl_kernel_entry_point attribute. (PR #152403)

2025-08-25 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann updated https://github.com/llvm/llvm-project/pull/152403 >From d0b53b9550d4332049b3b28ca649e2cf47a0cfbc Mon Sep 17 00:00:00 2001 From: Tom Honermann Date: Wed, 6 Aug 2025 19:26:54 -0700 Subject: [PATCH 1/4] [SYCL] SYCL host kernel launch support for the sycl_kern

[clang] [NFC] Remove unneeded forward declaration of diagnoseUncapturableValueReferenceOrBinding() (PR #154591)

2025-08-20 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann created https://github.com/llvm/llvm-project/pull/154591 The only (remaining) use of this forward declaration was removed in commit 127bf44385424891eb04cff8e52d3f157fc2cb7c. >From a35c62390074972fe272bc4f0f2a82da5b65 Mon Sep 17 00:00:00 2001 From: Tom Honerman

[clang] [NFC][SYCL] Test use of sycl_kernel_entry_point with null declarations and statements. (PR #154583)

2025-08-20 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann created https://github.com/llvm/llvm-project/pull/154583 The `sycl_kernel_entry_point` attribute only appertains to functions. This change adds missing tests to validate that an appropriate diagnostic is issued for likely unintentional application of the attribut

[clang] [NFC] Remove unneeded forward declaration of diagnoseUncapturableValueReferenceOrBinding() (PR #154591)

2025-08-20 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann closed https://github.com/llvm/llvm-project/pull/154591 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2   3   4   5   6