Skip to content

Commit b2da04e

Browse files
Fznamznonbader
authored andcommitted
[SYCL] Expand assertion for SYCL
Case when function scope variable codegen-ed as global variable is possible for both OpenCL and SYCL, for example local variables defined by user are turned into globals in the local address space. Signed-off-by: Mariya Podchishchaeva <[email protected]>
1 parent 7ec00ca commit b2da04e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clang/lib/CodeGen/CGDeclCXX.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ using namespace CodeGen;
2626

2727
static void EmitDeclInit(CodeGenFunction &CGF, const VarDecl &D,
2828
ConstantAddress DeclPtr) {
29-
assert(
30-
(D.hasGlobalStorage() ||
31-
(D.hasLocalStorage() && CGF.getContext().getLangOpts().OpenCLCPlusPlus)) &&
32-
"VarDecl must have global or local (in the case of OpenCL) storage!");
29+
assert((D.hasGlobalStorage() ||
30+
(D.hasLocalStorage() &&
31+
(CGF.getContext().getLangOpts().OpenCLCPlusPlus ||
32+
CGF.getContext().getLangOpts().SYCLIsDevice))) &&
33+
"VarDecl must have global or local (in the case of OpenCL and SYCL) "
34+
"storage!");
3335
assert(!D.getType()->isReferenceType() &&
3436
"Should not call EmitDeclInit on a reference!");
3537

0 commit comments

Comments
 (0)