================
@@ -665,6 +667,51 @@ OutlinedFunctionDecl 
*BuildSYCLKernelEntryPointOutline(Sema &SemaRef,
   return OFD;
 }
 
+class KernelArgsChecker : public SubobjectVisitor<KernelArgsChecker> {
+  SemaSYCL &SemaSYCLRef;
+  bool IsValid = true;
+  SmallVector<const CXXRecordDecl *, 4> History;
+
+public:
+  KernelArgsChecker(SemaSYCL &SR, SourceLocation Loc)
+      : SubobjectVisitor<KernelArgsChecker>(SR.getASTContext()),
+        SemaSYCLRef(SR) {}
+  bool enterRecord(CXXRecordDecl *Record, FieldDecl *Parent) {
+    History.push_back(Record);
+    return getDerived().visitRecord(Record, Parent);
+  }
+
+  bool visitReferenceType(QualType Ty, FieldDecl *Parent) {
+    SemaSYCLRef.Diag(Parent->getLocation(), diag::err_bad_kernel_param_type)
+        << Ty;
+    for (auto &ParentRecord : History)
+      SemaSYCLRef.Diag(ParentRecord->getLocation(),
+                       diag::note_within_field_of_type)
+          << ParentRecord;
----------------
Fznamznon wrote:

Sure, added.

https://github.com/llvm/llvm-project/pull/192957
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to