@@ -312,15 +312,15 @@ static void collectSYCLAttributes(Sema &S, FunctionDecl *FD,
312
312
bool DirectlyCalled = true ) {
313
313
if (!FD->hasAttrs ())
314
314
return ;
315
- for (Attr *A : FD-> getAttrs ()) {
316
- if (isa<IntelReqdSubGroupSizeAttr, ReqdWorkGroupSizeAttr,
317
- SYCLIntelKernelArgsRestrictAttr, SYCLIntelNumSimdWorkItemsAttr ,
318
- SYCLIntelSchedulerTargetFmaxMhzAttr, SYCLIntelMaxWorkGroupSizeAttr ,
319
- SYCLIntelMaxGlobalWorkDimAttr, SYCLIntelNoGlobalWorkOffsetAttr ,
320
- SYCLSimdAttr>(A)) {
321
- Attrs. push_back (A);
322
- }
323
- }
315
+
316
+ llvm::copy_if (FD-> getAttrs (), std::back_inserter (Attrs), [](Attr *A) {
317
+ return isa<IntelReqdSubGroupSizeAttr, ReqdWorkGroupSizeAttr ,
318
+ SYCLIntelKernelArgsRestrictAttr, SYCLIntelNumSimdWorkItemsAttr ,
319
+ SYCLIntelSchedulerTargetFmaxMhzAttr ,
320
+ SYCLIntelMaxWorkGroupSizeAttr, SYCLIntelMaxGlobalWorkDimAttr,
321
+ SYCLIntelNoGlobalWorkOffsetAttr, SYCLSimdAttr> (A);
322
+ });
323
+
324
324
// Allow the kernel attribute "use_stall_enable_clusters" only on lambda
325
325
// functions and function objects called directly from a kernel.
326
326
// For all other cases, emit a warning and ignore.
@@ -542,9 +542,9 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
542
542
continue ; // We've already seen this Decl
543
543
544
544
// Gather all attributes of FD that are SYCL related.
545
- // Some attributes are allowed only on lambda
546
- // functions and function objects called directly from a kernel
547
- // (i.e. the one passed to the single_task or parallel_for functions).
545
+ // Some attributes are allowed only on lambda functions and function
546
+ // objects called directly from a kernel (i.e. the one passed to the
547
+ // single_task or parallel_for functions).
548
548
bool DirectlyCalled = (ParentFD == SYCLKernel);
549
549
collectSYCLAttributes (SemaRef, FD, Attrs, DirectlyCalled);
550
550
@@ -3197,7 +3197,7 @@ void Sema::copySYCLKernelAttrs(const CXXRecordDecl *KernelObj) {
3197
3197
llvm::SmallVector<Attr *, 4 > Attrs;
3198
3198
collectSYCLAttributes (*this , KernelBody, Attrs);
3199
3199
if (!Attrs.empty ())
3200
- OpParens-> setAttrs (Attrs );
3200
+ llvm::for_each (Attrs, [ OpParens](Attr *A) { OpParens-> addAttr (A); } );
3201
3201
}
3202
3202
}
3203
3203
0 commit comments