[PATCH] Support OpenCL 1.2 'extern' storage class

Joey Gouly joey.gouly at arm.com
Wed Jan 22 09:09:21 PST 2014


That's what it looks like (my fault), since I added a warning for constant
variables without initializers.

LGTM

Joey

-----Original Message-----
From: cfe-commits-bounces at cs.uiuc.edu
[mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of Tom Stellard
Sent: 22 January 2014 17:02
To: Fraser Cormack
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [PATCH] Support OpenCL 1.2 'extern' storage class

On Wed, Jan 22, 2014 at 04:03:29PM +0000, Fraser Cormack wrote:
> This patch allows clang to compile the "extern" storage class in OpenCL
1.2.
> 
> I've also added a test case for the issue.

Does clang only complain if you use extern with constant address space
variables?  Because it looks like extern is already handled in
DeclSpec::SetStorageClassSpec()

-Tom

> 
> Cheers,
> Fraser
> 
> -- 
> Fraser Cormack
> Compiler Developer
> Codeplay Software Ltd
> 45 York Place, Edinburgh, EH1 3HP
> Tel: 0131 466 0503
> Fax: 0131 557 6600
> Website: http://www.codeplay.com
> Twitter: https://twitter.com/codeplaysoft
> 
> This email and any attachments may contain confidential and /or privileged
information and  is for use  by the addressee only. If you are not the
intended recipient, please notify Codeplay Software Ltd immediately and
delete the message from your computer. You may not copy or forward it,or use
or disclose its contents to any other person. Any views or other information
in this message which do not relate to our business are not authorized by
Codeplay software Ltd, nor does this message form part of any contract
unless so stated.
> As internet communications are capable of data corruption Codeplay
Software Ltd does not accept any responsibility for any changes made to this
message after it was sent. Please note that Codeplay Software Ltd does not
accept any liability or responsibility for viruses and it is your
responsibility to scan any attachments.
> Company registered in England and Wales, number: 04567874
> Registered office: 81 Linkfield Street, Redhill RH1 6BY
> 

> Index: lib/Sema/SemaDecl.cpp
> ===================================================================
> --- lib/Sema/SemaDecl.cpp	(revision 199802)
> +++ lib/Sema/SemaDecl.cpp	(working copy)
> @@ -8541,7 +8541,7 @@
>      // be initialized.
>      if (!Var->isInvalidDecl() &&
>          Var->getType().getAddressSpace() == LangAS::opencl_constant &&
> -        !Var->getInit()) {
> +        Var->getStorageClass() != SC_Extern && !Var->getInit()) {
>        Diag(Var->getLocation(), diag::err_opencl_constant_no_init);
>        Var->setInvalidDecl();
>        return;
> Index: test/SemaOpenCL/extern.cl
> ===================================================================
> --- test/SemaOpenCL/extern.cl	(revision 0)
> +++ test/SemaOpenCL/extern.cl	(working copy)
> @@ -0,0 +1,8 @@
> +// RUN: %clang_cc1 %s -cl-std=CL1.2 -verify -fsyntax-only
> +// expected-no-diagnostics
> +
> +extern constant float foo;
> +
> +kernel void test(global float* buf) {
> +  buf[0] += foo;
> +}

> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
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