[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:59:24 PST 2016
tra added inline comments.
================
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;
----------------
jlebar wrote:
> tra wrote:
> > Perhaps we should emit diagnostics on device side only.
> Hm. I don't feel strongly, but since we're talking about __global__ functions, this seems sort of relevant for both host and device compilation?
Host-only works, too. Printing this on both host and device is a bit too much.
http://reviews.llvm.org/D16261
More information about the cfe-commits
mailing list