[cfe-commits] [PATCH] OpenCL event type
Benyei, Guy
guy.benyei at intel.com
Thu Dec 20 03:13:10 PST 2012
Hi Dmitri,
Thanks for the review.
Attached the updated patch. Please review.
Thanks
Guy Benyei
-----Original Message-----
From: Dmitri Gribenko [mailto:gribozavr at gmail.com]
Sent: Wednesday, December 19, 2012 01:36
To: Benyei, Guy
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] [PATCH] OpenCL event type
On Wed, Dec 19, 2012 at 1:19 AM, Benyei, Guy <guy.benyei at intel.com> wrote:
> The attached patch implements OpenCL event_t as Clang builtin type.
>
> According to the OpenCL spec, this type can’t be initialized, but one
> may use NULL instead of it when calling a function.
+ if (Entity.getKind() != InitializedEntity::EK_Parameter)
+ S.Diag(Kind.getLocation(), diag::err_event_initialization);
+ else if (!CurInit.get()->isNullPointerConstant(S.getASTContext(),
+ Expr::NPC_ValueDependentIsNull))
+ S.Diag(Kind.getLocation(), diag::err_event_argument_not_null)
+ << SourceType;
Indentation is funny here (uses 4 spaces instead of 2, function arguments not aligned to the previous line).
+ event_t e = 0; // expected-error {{cannot initialize event_t}}
A better wording, maybe: "initialization of event_t variables is not allowed". Current wording suggests that there's something to the initialization that can be fixed.
+ foo(5); // expected-error {{event_t variable or NULL required - got
+ 'int'}}
This does not feel like a Clang error message to me. A better wording might be "passing %1 as event_t function parameter is not allowed; use an event_t variable or NULL" -- but there are certainly better alternatives.
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opencl_events2.patch
Type: application/octet-stream
Size: 28824 bytes
Desc: opencl_events2.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121220/12d93e5a/attachment.obj>
More information about the cfe-commits
mailing list