Skip to content

Commit 1020a12

Browse files
committed
Fix diagnostic message and comment
Signed-off-by: Premanand M Rao <[email protected]>
1 parent bea5db9 commit 1020a12

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10850,7 +10850,7 @@ def err_sycl_restrict : Error<
1085010850
"|call a dllimport function"
1085110851
"|call a variadic function"
1085210852
"|call an undefined function without SYCL_EXTERNAL attribute"
10853-
"|use a const static variable that is neither zero-initialized "
10853+
"|use a const static or global variable that is neither zero-initialized "
1085410854
"nor constant-initialized"
1085510855
"}0">;
1085610856
def err_sycl_virtual_types : Error<

clang/lib/Sema/SemaExpr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
223223
VD->hasGlobalStorage() && !isa<ParmVarDecl>(VD))
224224
SYCLDiagIfDeviceCode(*Locs.begin(), diag::err_sycl_restrict)
225225
<< Sema::KernelGlobalVariable;
226-
// Disallow const statics that are not zero-initialized
227-
// or constant-initialized
226+
// Disallow const statics and globals that are not zero-initialized
227+
// or constant-initialized.
228228
else if (IsConst && VD->hasGlobalStorage() && !VD->isConstexpr() &&
229229
!checkAllowedSYCLInitializer(VD, /*CheckValueDependent =*/true))
230230
SYCLDiagIfDeviceCode(*Locs.begin(), diag::err_sycl_restrict)

clang/test/SemaSYCL/sycl-device-const-static.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ void usage() {
2828
const static int cs = 0;
2929
constexpr static int ces = 0;
3030
static const S s6;
31-
// expected-error@+1{{SYCL kernel cannot use a const static variable that is neither zero-initialized nor constant-initialized}}
31+
// expected-error@+1{{SYCL kernel cannot use a const static or global variable that is neither zero-initialized nor constant-initialized}}
3232
(void)T::s1;
33-
// expected-error@+1{{SYCL kernel cannot use a const static variable that is neither zero-initialized nor constant-initialized}}
33+
// expected-error@+1{{SYCL kernel cannot use a const static or global variable that is neither zero-initialized nor constant-initialized}}
3434
(void)s5;
35-
// expected-error@+1{{SYCL kernel cannot use a const static variable that is neither zero-initialized nor constant-initialized}}
35+
// expected-error@+1{{SYCL kernel cannot use a const static or global variable that is neither zero-initialized nor constant-initialized}}
3636
(void)s6;
3737
}
3838

@@ -42,7 +42,7 @@ __attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
4242
static int z;
4343
// expected-note-re@+3{{called by 'kernel_single_task<fake_kernel, (lambda at {{.*}})>}}
4444
// expected-note-re@+2{{called by 'kernel_single_task<fake_kernel, (lambda at {{.*}})>}}
45-
// expected-error@+1{{SYCL kernel cannot use a const static variable that is neither zero-initialized nor constant-initialized}}
45+
// expected-error@+1{{SYCL kernel cannot use a const static or global variable that is neither zero-initialized nor constant-initialized}}
4646
kernelFunc(U<Base>::s2);
4747
}
4848

0 commit comments

Comments
 (0)