Skip to content

[SYCL] Do not emit const static data members that are not const-… #2019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix clang format errors
Signed-off-by: Premanand M Rao <premanand.m.rao@intel.com>
  • Loading branch information
premanandrao committed Jul 4, 2020
commit bea5db929b4003b451b653ac0f36e9d22f5372cf
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1854,8 +1854,8 @@ bool Sema::checkAllowedSYCLInitializer(VarDecl *VD, bool CheckValueDependent) {

const Expr *Init = VD->getInit();
bool ValueDependent = CheckValueDependent && Init->isValueDependent();
bool isConstantInit = Init && !ValueDependent &&
Init->isConstantInitializer(Context, false);
bool isConstantInit =
Init && !ValueDependent && Init->isConstantInitializer(Context, false);
if (!VD->isConstexpr() && Init && !ValueDependent && !isConstantInit)
return false;

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5104,7 +5104,7 @@ void Sema::InstantiateVariableInitializer(

if (getLangOpts().SYCLIsDevice && !checkAllowedSYCLInitializer(Var))
SYCLDiagIfDeviceCode(Var->getLocation(), diag::err_sycl_restrict)
<< Sema::KernelConstStaticVariable;
<< Sema::KernelConstStaticVariable;
}

/// Instantiate the definition of the given variable from its
Expand Down
1 change: 0 additions & 1 deletion clang/test/SemaSYCL/sycl-device-const-static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ void usage() {
(void)s6;
}


template <typename Name, typename Func>
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
// expected-error@+1{{SYCL kernel cannot use a non-const static data variable}}
Expand Down