Skip to content

Commit 718c0b1

Browse files
authored
[SYCL] Silence "unknown attribute" warning for device_indirectly_callable (#5591)
The compiler used to emit "unknown attribute" warnings during host part of full -fsycl compilation when it saw `[[intel::device_indirectly_callable]]` attribute.
1 parent d54708a commit 718c0b1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clang/include/clang/Basic/Attr.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ def SYCLScope : Attr {
13471347
def SYCLDeviceIndirectlyCallable : InheritableAttr {
13481348
let Spellings = [ CXX11<"intel", "device_indirectly_callable"> ];
13491349
let Subjects = SubjectList<[Function]>;
1350-
let LangOpts = [SYCLIsDevice];
1350+
let LangOpts = [SYCLIsDevice, SilentlyIgnoreSYCLIsHost];
13511351
let Documentation = [SYCLDeviceIndirectlyCallableDocs];
13521352
}
13531353

clang/test/SemaSYCL/device-indirectly-callable-attr.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
22
// RUN: not %clang_cc1 -fsycl-is-device -ast-dump %s | FileCheck %s
33
// RUN: %clang_cc1 -verify -DNO_SYCL %s
4+
// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -verify -DSYCL_HOST %s
45

5-
#ifndef NO_SYCL
6+
#if !defined(NO_SYCL) || defined(SYCL_HOST)
67

78
[[intel::device_indirectly_callable]] // expected-warning {{'device_indirectly_callable' attribute only applies to functions}}
89
int N;

0 commit comments

Comments
 (0)