[PATCH][OpenCL] Check that kernel returns void type

Tanya Lattner lattner at apple.com
Tue Jan 29 16:51:30 PST 2013


On Jan 29, 2013, at 4:14 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> --- 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.
> 

Actually, this is a mistake as that check is not standard for OpenCL so I will remove it. Updated patch attached.


-Tanya

-------------- next part --------------
A non-text attachment was scrubbed...
Name: voidKernelCheck2.patch
Type: application/octet-stream
Size: 1649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130129/f324f483/attachment.obj>
-------------- next part --------------



> On Tue, Jan 29, 2013 at 3:50 PM, Tanya Lattner <lattner at apple.com> 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
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> 



More information about the cfe-commits mailing list