--- lib/Sema/SemaDecl.cpp       (revision 173469)
+++ lib/Sema/SemaDecl.cpp       (working copy)
@@ -6178,7 +6178,15 @@
       Diag(D.getIdentifierLoc(), diag::err_static_kernel);
       D.setInvalidType();
     }
-
+
+    // OpenCL v1.2, s6.9 -- Kernels can only have return type void.
+    if (!NewFD->getResultType()->isVoidType() &&
+        !NewFD->getAttr<SectionAttr>()) {

Use hasAttr<SectionAttr> not getAttr<SectionAttr>. Also, test coverage
for this half of the check would be useful.

On Tue, Jan 29, 2013 at 3:50 PM, Tanya Lattner <[email protected]> wrote:
> Sending this patch for review. I made some changes to it based upon previous 
> feedback. This is a simple error check to see if the kernel returns void type.
>
> Thanks,
> Tanya
>
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to