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
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
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
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
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
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
@@ -410,6 +474,36 @@ class OutlinedFunctionDeclBodyInstantiator
ParmDeclMap &MapRef;
};
+OutlinedFunctionDecl *BuildSYCLKernelEntryPointOutline(Sema &SemaRef,
+ FunctionDecl *FD,
+
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
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
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-
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
@@ -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
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
__
@@ -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
@@ -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
@@ -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:
@@ -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
@@ -367,6 +370,67 @@ void
SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
namespace {
+CompoundStmt *BuildSYCLKernelLaunchStmt(Sema &SemaRef, FunctionDecl *FD,
+const std::string &KernelName) {
+ ASTContext &Ctx = SemaRe
@@ -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:
@@ -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:
@@ -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
@@ -367,6 +370,67 @@ void
SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
namespace {
+CompoundStmt *BuildSYCLKernelLaunchStmt(Sema &SemaRef, FunctionDecl *FD,
+const std::string &KernelName) {
+ ASTContext &Ctx = SemaRe
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] [SYCL] SYCL host kernel launch support for the
sycl_kernel_e
https://github.com/tahonermann updated
https://github.com/llvm/llvm-project/pull/151405
>From 17fd9871a422cb2b4c3697b66011ae7f5c84379d Mon Sep 17 00:00:00 2001
From: Tom Honermann
Date: Wed, 30 Jul 2025 14:52:03 -0700
Subject: [PATCH 1/2] [SYCL] Restrict the sycl_kernel_entry_point attribute
s
@@ -0,0 +1,73 @@
+// 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
@@ -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:
@@ -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:
@@ -12937,6 +12937,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
if (D->hasAttr())
return false;
+ if (LangOpts.SYCLIsDevice && !D->hasAttr() &&
+ !D->hasAttr())
tahonermann wrote:
Your suggested change would not be correct because it
@@ -12937,6 +12937,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
if (D->hasAttr())
return false;
+ if (LangOpts.SYCLIsDevice && !D->hasAttr() &&
+ !D->hasAttr())
tahonermann wrote:
I mentioned global variables are just one example; we
@@ -1641,6 +1641,13 @@ def DeviceKernel : DeclOrTypeAttr {
}];
}
+def SYCLExternal : InheritableAttr {
+ let Spellings = [Clang<"sycl_external">];
tahonermann wrote:
Ok, I'm fine with dropping the GNU spelling. But in that case, we should also
change the `s
@@ -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:
@@ -16275,6 +16297,13 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt
*Body,
}
}
+ if (FD && !FD->isInvalidDecl() && FD->hasAttr()) {
+SYCLExternalAttr *SEAttr = FD->getAttr();
+if (FD->isDeletedAsWritten())
tahonermann wrote:
Sindhu an
@@ -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
@@ -12937,6 +12937,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
if (D->hasAttr())
return false;
+ if (LangOpts.SYCLIsDevice && !D->hasAttr() &&
+ !D->hasAttr())
tahonermann wrote:
That is intentional and consistent with what DPC++ doe
@@ -12908,6 +12908,14 @@ 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_invalid_linkage : Error<
+ "'sy
@@ -1641,6 +1641,13 @@ def DeviceKernel : DeclOrTypeAttr {
}];
}
+def SYCLExternal : InheritableAttr {
+ let Spellings = [Clang<"sycl_external">];
tahonermann wrote:
We use the `Clang` spelling for `sycl_kernel_entry_point`, what would be the
reason for doi
@@ -476,6 +476,47 @@ The SYCL kernel in the previous code sample meets these
expectations.
}];
}
+def SYCLExternalDocs : Documentation {
+ let Category = DocCatFunction;
+ let Heading = "sycl_external";
+ let Content = [{
+The ``sycl_external`` attribute indicates that a
@@ -12952,8 +12956,11 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
if (LangOpts.SYCLIsDevice && FD->hasAttr())
return true;
-// FIXME: Functions declared with SYCL_EXTERNAL are required during
-// device compilation.
+// Function definitions wit
https://github.com/tahonermann approved this pull request.
I love it @schittir, this looks great!
@erichkeane, @bader, please review and lend your approval. Note that some of
the changes to the tests are to synchronize them with continued evolution that
happened in DPC++ but was not previously
@@ -476,6 +476,48 @@ The SYCL kernel in the previous code sample meets these
expectations.
}];
}
+def SYCLExternalDocs : Documentation {
+ let Category = DocCatFunction;
+ let Heading = "sycl_external";
+ let Content = [{
+The ``sycl_external`` attribute indicates that a
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// expected-error@+1{{'clang::sycl_external' attribute only applies to
functions}}
+[[clang::sycl_external]] int a;
+
+
+// expected-error@+2{{'clang::sycl_external' attribute only applies to
funct
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsycl-is-device -std=c++20 -fsyntax-only -verify -DCPP20 %s
+// Semantic tests for sycl_external attribute
+
+[[clang::sycl_external]] // expected-error {{'sycl_external' can only b
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// expected-error@+1{{'clang::sycl_external' attribute only applies to
functions}}
+[[clang::sycl_external]] int a;
+
+
+// expected-error@+2{{'clang::sycl_external' attribute only applies to
funct
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsycl-is-device -std=c++20 -fsyntax-only -verify -DCPP20 %s
+// Semantic tests for sycl_external attribute
tahonermann wrote:
Add spacing to avoid potential merge
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// expected-warning@+1{{'clang::sycl_external' attribute ignored}}
tahonermann wrote:
```suggestion
// These tests validate that the sycl_external attribute is ignored when SYCL
// support is not en
@@ -12879,6 +12879,15 @@ 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_invalid_linkage : Error<
+ "'sy
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// expected-warning@+1{{'clang::sycl_external' attribute ignored}}
+[[clang::sycl_external]] void bar() {}
+
+// expected-warning@+1{{'clang::sycl_external' attribute ignored}}
+[[clang::sycl_external]] int a;
+
+//
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
https://github.com/tahonermann requested changes to this pull request.
A few more comments. I still haven't finished my review of
`sycl-external-attr.cpp`, but will try to later today or over the weekend.
https://github.com/llvm/llvm-project/pull/140282
_
https://github.com/tahonermann requested changes to this pull request.
This is looking good @schittir! I added some comments for minor issues. I still
need to review the tests more closely.
https://github.com/llvm/llvm-project/pull/140282
___
cfe-comm
@@ -1641,6 +1641,13 @@ def DeviceKernel : DeclOrTypeAttr {
}];
}
+def SYCLExternal : InheritableAttr {
+ let Spellings = [Clang<"sycl_external">];
+ let Subjects = SubjectList<[Function], ErrorDiag>;
+ let LangOpts = [SYCLDevice];
tahonermann wrote:
In res
@@ -4084,6 +4084,19 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New,
NamedDecl *&OldD, Scope *S,
diag::note_carries_dependency_missing_first_decl) << 0/*Function*/;
}
+// SYCL spec 2020
+// The first declaration of a function with external linkage m
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
@@ -4084,6 +4084,19 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New,
NamedDecl *&OldD, Scope *S,
diag::note_carries_dependency_missing_first_decl) << 0/*Function*/;
}
+// SYCL spec 2020
+// The first declaration of a function with external linkage m
@@ -4084,6 +4084,19 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New,
NamedDecl *&OldD, Scope *S,
diag::note_carries_dependency_missing_first_decl) << 0/*Function*/;
}
+// SYCL spec 2020
+// The first declaration of a function with external linkage m
@@ -100,11 +100,9 @@ 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
@@ -12879,6 +12879,16 @@ 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_invalid_linkage : Error<
+ "'sy
@@ -1,19 +1,19 @@
// RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -aux-triple
x86_64-pc-windows-msvc -fsycl-is-device -disable-llvm-passes -fsycl-is-device
-emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE=addrspace(1) '
-// RUN: %clang_cc1 -triple x86_64-pc-windows-
@@ -1,19 +1,19 @@
// RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -aux-triple
x86_64-pc-windows-msvc -fsycl-is-device -disable-llvm-passes -fsycl-is-device
-emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE=addrspace(1) '
tahonermann wrote:
The redun
@@ -1,19 +1,19 @@
// RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -aux-triple
x86_64-pc-windows-msvc -fsycl-is-device -disable-llvm-passes -fsycl-is-device
-emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE=addrspace(1) '
-// RUN: %clang_cc1 -triple x86_64-pc-windows-
@@ -1,19 +1,19 @@
// RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -aux-triple
x86_64-pc-windows-msvc -fsycl-is-device -disable-llvm-passes -fsycl-is-device
-emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE=addrspace(1) '
-// RUN: %clang_cc1 -triple x86_64-pc-windows-
https://github.com/tahonermann requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/146854
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1590,25 +1590,70 @@ namespace {
void EmitConditionalDtorDeleteCall(CodeGenFunction &CGF,
tahonermann wrote:
Thanks, the new comment looks great.
https://github.com/llvm/llvm-project/pull/139566
___
cfe-commits m
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// Semantic tests for sycl_external attribute
+
+[[clang::sycl_external]] // expected-error {{'sycl_external' can only be
applied to functions with external linkage}}
+static void func1() {}
+
+name
@@ -208,6 +208,15 @@ void SemaSYCL::handleExternalAttr(Decl *D, const
ParsedAttr &AL) {
Diag(AL.getLoc(), diag::err_sycl_attribute_invalid_linkage);
return;
}
+ std::string FunctionName =
StringRef(FD->getNameInfo().getAsString()).lower();
+ if (FunctionName.find(
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// Semantic tests for sycl_external attribute
+
+[[clang::sycl_external]] // expected-error {{'sycl_external' can only be
applied to functions with external linkage}}
+static void func1() {}
+
+name
@@ -12856,6 +12856,14 @@ 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_invalid_linkage : Error<
+ "'sy
@@ -202,6 +202,25 @@ void SemaSYCL::handleKernelAttr(Decl *D, const ParsedAttr
&AL) {
handleSimpleAttribute(*this, D, AL);
}
+void SemaSYCL::handleExternalAttr(Decl *D, const ParsedAttr &AL) {
+ auto *FD = cast(D);
+ if (!FD->isExternallyVisible()) {
+Diag(AL.getLoc()
https://github.com/tahonermann requested changes to this pull request.
Additional comments for diagnostics and tests.
https://github.com/llvm/llvm-project/pull/140282
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bi
@@ -7206,6 +7206,9 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
const ParsedAttr &AL,
case ParsedAttr::AT_EnumExtensibility:
handleEnumExtensibilityAttr(S, D, AL);
break;
+ case ParsedAttr::AT_SYCLExternal:
+S.SYCL().handleExternalAttr(D, AL);
---
@@ -2886,6 +2887,16 @@ class CXXDestructorDecl : public CXXMethodDecl {
return getCanonicalDecl()->OperatorDelete;
}
+ const FunctionDecl *getOperatorGlobalDelete() const {
+return getCanonicalDecl()->OperatorGlobalDelete;
+ }
+
+ void setOperatorGlobalDelete(Func
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// Semantic tests for sycl_external attribute
+
+[[clang::sycl_external]] // expected-error {{'sycl_external' can only be
applied to functions with external linkage}}
+static void func1() {}
+
+name
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// Semantic tests for sycl_external attribute
+
+[[clang::sycl_external]] // expected-error {{'sycl_external' can only be
applied to functions with external linkage}}
+static void func1() {}
+
+name
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// Semantic tests for sycl_external attribute
+
+[[clang::sycl_external]] // expected-error {{'sycl_external' can only be
applied to functions with external linkage}}
+static void func1() {}
+
+name
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
@@ -202,6 +202,25 @@ void SemaSYCL::handleKernelAttr(Decl *D, const ParsedAttr
&AL) {
handleSimpleAttribute(*this, D, AL);
}
+void SemaSYCL::handleExternalAttr(Decl *D, const ParsedAttr &AL) {
+ auto *FD = cast(D);
+ if (!FD->isExternallyVisible()) {
+Diag(AL.getLoc()
@@ -12856,6 +12856,14 @@ 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_invalid_linkage : Error<
+ "'sy
@@ -2886,6 +2887,16 @@ class CXXDestructorDecl : public CXXMethodDecl {
return getCanonicalDecl()->OperatorDelete;
}
+ const FunctionDecl *getOperatorGlobalDelete() const {
+return getCanonicalDecl()->OperatorGlobalDelete;
+ }
+
+ void setOperatorGlobalDelete(Func
@@ -2886,6 +2887,16 @@ class CXXDestructorDecl : public CXXMethodDecl {
return getCanonicalDecl()->OperatorDelete;
}
+ const FunctionDecl *getOperatorGlobalDelete() const {
+return getCanonicalDecl()->OperatorGlobalDelete;
+ }
+
+ void setOperatorGlobalDelete(Func
@@ -46,6 +46,16 @@ Potentially Breaking Changes
``endbr64`` instruction at the labels named as possible branch
destinations, so it is not safe to use a register-controlled branch
instruction to branch to one. (In line with gcc.)
+- Scalar deleting destructors emitted by c
@@ -476,6 +476,41 @@ The SYCL kernel in the previous code sample meets these
expectations.
}];
}
+def SYCLExternalDocs : Documentation {
+ let Category = DocCatFunction;
+ let Heading = "sycl_external";
+ let Content = [{
+The ``sycl_external`` attribute indicates that a
@@ -476,6 +476,41 @@ The SYCL kernel in the previous code sample meets these
expectations.
}];
}
+def SYCLExternalDocs : Documentation {
+ let Category = DocCatFunction;
+ let Heading = "sycl_external";
+ let Content = [{
+The ``sycl_external`` attribute indicates that a
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
https://github.com/tahonermann requested changes to this pull request.
Thanks for addressing most of my earlier comments. I took another quick look
today and added a couple more comments.
https://github.com/llvm/llvm-project/pull/140282
___
cfe-commit
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// expected-warning@+1{{'sycl_external' attribute ignored}}
+[[clang::sycl_external]] void bar() {}
+
+// expected-warning@+1{{'sycl_external' attribute ignored}}
+[[clang::sycl_external]] int a;
tah
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// expected-warning@+1{{'sycl_external' attribute only applies to functions}}
+[[clang::sycl_external]] int a;
+
+
+// expected-warning@+2{{'sycl_external' attribute only applies to functions}}
+stru
https://github.com/tahonermann requested changes to this pull request.
Thanks @schittir, here are my initial review comments. I expect to review the
newly added tests more closely once these comments are all addressed.
https://github.com/llvm/llvm-project/pull/140282
___
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// expected-warning@+1{{'sycl_external' attribute ignored}}
+[[clang::sycl_external]] void bar() {}
+
+// expected-warning@+1{{'sycl_external' attribute ignored}}
+[[clang::sycl_external]] int a;
tah
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// expected-warning@+1{{'sycl_external' attribute only applies to functions}}
+[[clang::sycl_external]] int a;
+
+
+// expected-warning@+2{{'sycl_external' attribute only applies to functions}}
+stru
@@ -476,6 +476,31 @@ The SYCL kernel in the previous code sample meets these
expectations.
}];
}
+def SYCLExternalDocs : Documentation {
+ let Category = DocCatFunction;
+ let Heading = "sycl_external";
+ let Content = [{
+The ``sycl_external`` attribute can only be appl
@@ -202,6 +202,17 @@ void SemaSYCL::handleKernelAttr(Decl *D, const ParsedAttr
&AL) {
handleSimpleAttribute(*this, D, AL);
}
+void SemaSYCL::handleExternalAttr(Decl *D, const ParsedAttr &AL) {
+ auto *ND = cast(D);
+ if (!ND->isExternallyVisible()) {
taho
@@ -1,128 +1,128 @@
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fsycl-is-device
-disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
void bar(int &Data) {}
-// CHECK: define dso_local void @[[RAW_REF:[a-zA-Z0-9_]+]](ptr noundef nonnull
align 4 dereferenceable(4) %
+// CHEC
@@ -202,6 +202,17 @@ void SemaSYCL::handleKernelAttr(Decl *D, const ParsedAttr
&AL) {
handleSimpleAttribute(*this, D, AL);
}
+void SemaSYCL::handleExternalAttr(Decl *D, const ParsedAttr &AL) {
+ auto *ND = cast(D);
+ if (!ND->isExternallyVisible()) {
+Diag(AL.getLoc()
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// Semantic tests for sycl_external attribute
+
+[[clang::sycl_external(3)]] // expected-error {{'sycl_external' attribute
takes no arguments}}
+void bar() {}
+
+[[clang::sycl_external]] // expected
@@ -12851,6 +12851,10 @@ 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
tahonermann wrote:
```suggestion
// SYC
1 - 100 of 538 matches
Mail list logo