Hi Dmitri,
Thanks for the review.

Attached the updated patch. Please review.

Thanks
    Guy Benyei

-----Original Message-----
From: Dmitri Gribenko [mailto:[email protected]] 
Sent: Wednesday, December 19, 2012 01:36
To: Benyei, Guy
Cc: [email protected]
Subject: Re: [cfe-commits] [PATCH] OpenCL event type

On Wed, Dec 19, 2012 at 1:19 AM, Benyei, Guy <[email protected]> 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 <[email protected]>*/
---------------------------------------------------------------------
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.

Attachment: opencl_events2.patch
Description: opencl_events2.patch

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to