[PATCH] D16261: [CUDA] Only allow __global__ on free functions and static member functions.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 19 15:36:36 PST 2016


tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

Small diags not. LGTM otherwise.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:3620-3629
@@ -3619,2 +3619,12 @@
   }
+  if (const auto *Method = dyn_cast<CXXMethodDecl>(FD)) {
+    if (Method->isInstance()) {
+      S.Diag(Method->getLocStart(), diag::err_kern_is_nonstatic_method)
+          << Method;
+      return;
+    }
+    S.Diag(Method->getLocStart(), diag::warn_kern_is_method) << Method;
+  }
+  if (FD->isInlineSpecified())
+    S.Diag(FD->getLocStart(), diag::warn_kern_is_inline) << FD;
 
----------------
Perhaps we should emit diagnostics on device side only.


http://reviews.llvm.org/D16261





More information about the cfe-commits mailing list