@@ -228,12 +228,6 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
228
228
229
229
CheckSYCLType(Callee->getReturnType(), Callee->getSourceRange());
230
230
231
- if (FunctionDecl *Def = Callee->getDefinition()) {
232
- if (!Def->hasAttr<SYCLDeviceAttr>()) {
233
- Def->addAttr(SYCLDeviceAttr::CreateImplicit(SemaRef.Context));
234
- SemaRef.addSyclDeviceDecl(Def);
235
- }
236
- }
237
231
if (auto const *FD = dyn_cast<FunctionDecl>(Callee)) {
238
232
// FIXME: We need check all target specified attributes for error if
239
233
// that function with attribute can not be called from sycl kernel. The
@@ -265,23 +259,6 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
265
259
bool VisitCXXConstructExpr(CXXConstructExpr *E) {
266
260
for (const auto &Arg : E->arguments())
267
261
CheckSYCLType(Arg->getType(), Arg->getSourceRange());
268
-
269
- CXXConstructorDecl *Ctor = E->getConstructor();
270
-
271
- if (FunctionDecl *Def = Ctor->getDefinition()) {
272
- Def->addAttr(SYCLDeviceAttr::CreateImplicit(SemaRef.Context));
273
- SemaRef.addSyclDeviceDecl(Def);
274
- }
275
-
276
- const auto *ConstructedType = Ctor->getParent();
277
- if (ConstructedType->hasUserDeclaredDestructor()) {
278
- CXXDestructorDecl *Dtor = ConstructedType->getDestructor();
279
-
280
- if (FunctionDecl *Def = Dtor->getDefinition()) {
281
- Def->addAttr(SYCLDeviceAttr::CreateImplicit(SemaRef.Context));
282
- SemaRef.addSyclDeviceDecl(Def);
283
- }
284
- }
285
262
return true;
286
263
}
287
264
@@ -321,31 +298,6 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
321
298
return true;
322
299
323
300
CheckSYCLType(E->getType(), E->getSourceRange());
324
- if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
325
- if (!VD->isLocalVarDeclOrParm() && VD->hasGlobalStorage()) {
326
- VD->addAttr(SYCLDeviceAttr::CreateImplicit(SemaRef.Context));
327
- SemaRef.addSyclDeviceDecl(VD);
328
- }
329
- }
330
- return true;
331
- }
332
-
333
- bool VisitCXXNewExpr(CXXNewExpr *E) {
334
- // Memory storage allocation is not allowed in kernels.
335
- // All memory allocation for the device is done on
336
- // the host using accessor classes. Consequently, the default
337
- // allocation operator new overloads that allocate
338
- // storage are disallowed in a SYCL kernel. The placement
339
- // new operator and any user-defined overloads that
340
- // do not allocate storage are permitted.
341
- if (FunctionDecl *FD = E->getOperatorNew()) {
342
- if (FunctionDecl *Def = FD->getDefinition()) {
343
- if (!Def->hasAttr<SYCLDeviceAttr>()) {
344
- Def->addAttr(SYCLDeviceAttr::CreateImplicit(SemaRef.Context));
345
- SemaRef.addSyclDeviceDecl(Def);
346
- }
347
- }
348
- }
349
301
return true;
350
302
}
351
303
@@ -1389,13 +1341,8 @@ void Sema::MarkDevice(void) {
1389
1341
}
1390
1342
}
1391
1343
for (const auto &elt : Marker.KernelSet) {
1392
- if (FunctionDecl *Def = elt->getDefinition()) {
1393
- if (!Def->hasAttr<SYCLDeviceAttr>()) {
1394
- Def->addAttr(SYCLDeviceAttr::CreateImplicit(Context));
1395
- addSyclDeviceDecl(Def);
1396
- }
1344
+ if (FunctionDecl *Def = elt->getDefinition())
1397
1345
Marker.TraverseStmt(Def->getBody());
1398
- }
1399
1346
}
1400
1347
}
1401
1348
@@ -1467,10 +1414,6 @@ static void emitCallToUndefinedFnDiag(Sema &SemaRef, const FunctionDecl *Callee,
1467
1414
if (Callee->getTemplatedKind() == FunctionDecl::TK_FunctionTemplate)
1468
1415
return;
1469
1416
1470
- // Don't emit diagnostic for functions not called from device code
1471
- if (!Caller->hasAttr<SYCLDeviceAttr>() && !Caller->hasAttr<SYCLKernelAttr>())
1472
- return;
1473
-
1474
1417
bool RedeclHasAttr = false;
1475
1418
1476
1419
for (const Decl *Redecl : Callee->redecls()) {
0 commit comments