@@ -228,12 +228,6 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
228228
229229 CheckSYCLType (Callee->getReturnType (), Callee->getSourceRange ());
230230
231- if (FunctionDecl *Def = Callee->getDefinition ()) {
232- if (!Def->hasAttr <SYCLDeviceAttr>()) {
233- Def->addAttr (SYCLDeviceAttr::CreateImplicit (SemaRef.Context ));
234- SemaRef.addSyclDeviceDecl (Def);
235- }
236- }
237231 if (auto const *FD = dyn_cast<FunctionDecl>(Callee)) {
238232 // FIXME: We need check all target specified attributes for error if
239233 // that function with attribute can not be called from sycl kernel. The
@@ -265,23 +259,6 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
265259 bool VisitCXXConstructExpr (CXXConstructExpr *E) {
266260 for (const auto &Arg : E->arguments ())
267261 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- }
285262 return true ;
286263 }
287264
@@ -321,31 +298,6 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
321298 return true ;
322299
323300 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- }
349301 return true ;
350302 }
351303
@@ -1389,13 +1341,8 @@ void Sema::MarkDevice(void) {
13891341 }
13901342 }
13911343 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 ())
13971345 Marker.TraverseStmt (Def->getBody ());
1398- }
13991346 }
14001347}
14011348
@@ -1467,10 +1414,6 @@ static void emitCallToUndefinedFnDiag(Sema &SemaRef, const FunctionDecl *Callee,
14671414 if (Callee->getTemplatedKind () == FunctionDecl::TK_FunctionTemplate)
14681415 return ;
14691416
1470- // Don't emit diagnostic for functions not called from device code
1471- if (!Caller->hasAttr <SYCLDeviceAttr>() && !Caller->hasAttr <SYCLKernelAttr>())
1472- return ;
1473-
14741417 bool RedeclHasAttr = false ;
14751418
14761419 for (const Decl *Redecl : Callee->redecls ()) {
0 commit comments