================
@@ -665,6 +666,101 @@ OutlinedFunctionDecl 
*BuildSYCLKernelEntryPointOutline(Sema &SemaRef,
   return OFD;
 }
 
+class KernelArgsChecker : public SubobjectVisitor<KernelArgsChecker> {
+  SemaSYCL &SemaSYCLRef;
+  bool IsValid = true;
+  using ObjectAccess =
+      llvm::PointerUnion<ParmVarDecl *, CXXBaseSpecifier *, FieldDecl *>;
+  SmallVector<ObjectAccess, 4> ObjectAccessPath;
+
+  void emitObjectAccessPathNotes() {
+    for (auto Parent : ObjectAccessPath) {
+      if (auto *FD = Parent.dyn_cast<FieldDecl *>()) {
+        SemaSYCLRef.Diag(FD->getParent()->getLocation(),
+                         diag::note_within_field_of_type)
+            << FD->getParent();
+      } else if (auto *BS = Parent.dyn_cast<CXXBaseSpecifier *>()) {
+        CXXRecordDecl *RD = BS->getType()->getAsCXXRecordDecl();
+        assert(RD);
+        SemaSYCLRef.Diag(BS->getBeginLoc(), diag::note_within_base_of_type)
+            << RD;
+      } else {
+        // Nothing to emit for ParmVarDecl since its location just points to
+        // skep-attributed function template.
----------------
tahonermann wrote:

Is the rationale for skipping a note for the `ParmVarDecl` based on that 
declaration being part of the SYCL RT implementation and not something that is 
written by the author of a kernel?

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