From b6fc79e627588d80f55b53e94595a84d4ad89aba Mon Sep 17 00:00:00 2001 From: Mariya Podchishchaeva Date: Wed, 16 Feb 2022 16:05:35 +0300 Subject: [PATCH 1/2] [SYCL] Silence "unknown attribute" warning for `device_indirectly_callable` The compiler used to emit "unknown attribute" warnings during host part of full -fsycl compilation when it saw `[[intel::device_indirectly_callable]]` attribute. --- clang/include/clang/Basic/Attr.td | 2 +- clang/test/SemaSYCL/device-indirectly-callable-attr.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 3b23bdfc3c130..5997601c2e2cc 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1347,7 +1347,7 @@ def SYCLScope : Attr { def SYCLDeviceIndirectlyCallable : InheritableAttr { let Spellings = [ CXX11<"intel", "device_indirectly_callable"> ]; let Subjects = SubjectList<[Function]>; - let LangOpts = [SYCLIsDevice]; + let LangOpts = [SYCLIsDevice, SilentlyIgnoreSYCLIsHost]; let Documentation = [SYCLDeviceIndirectlyCallableDocs]; } diff --git a/clang/test/SemaSYCL/device-indirectly-callable-attr.cpp b/clang/test/SemaSYCL/device-indirectly-callable-attr.cpp index b55ec20db3753..a2da0a61f1900 100644 --- a/clang/test/SemaSYCL/device-indirectly-callable-attr.cpp +++ b/clang/test/SemaSYCL/device-indirectly-callable-attr.cpp @@ -1,8 +1,9 @@ // RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s // RUN: not %clang_cc1 -fsycl-is-device -ast-dump %s | FileCheck %s // RUN: %clang_cc1 -verify -DNO_SYCL %s +// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -verify -DSYCL_HOST %s -#ifndef NO_SYCL +#if !defined(NO_SYCL) || defined (SYCL_HOST) [[intel::device_indirectly_callable]] // expected-warning {{'device_indirectly_callable' attribute only applies to functions}} int N; From 8dbe8fa6ff5a0a984f2c9339353f89bc31482b90 Mon Sep 17 00:00:00 2001 From: Mariya Podchishchaeva Date: Wed, 16 Feb 2022 16:18:12 +0300 Subject: [PATCH 2/2] Fix formatting --- clang/test/SemaSYCL/device-indirectly-callable-attr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/SemaSYCL/device-indirectly-callable-attr.cpp b/clang/test/SemaSYCL/device-indirectly-callable-attr.cpp index a2da0a61f1900..a79f3f8eae244 100644 --- a/clang/test/SemaSYCL/device-indirectly-callable-attr.cpp +++ b/clang/test/SemaSYCL/device-indirectly-callable-attr.cpp @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -verify -DNO_SYCL %s // RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -verify -DSYCL_HOST %s -#if !defined(NO_SYCL) || defined (SYCL_HOST) +#if !defined(NO_SYCL) || defined(SYCL_HOST) [[intel::device_indirectly_callable]] // expected-warning {{'device_indirectly_callable' attribute only applies to functions}} int N;