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]>*/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits