[cfe-dev] OpenCL vec_step feature implementation - Updated patch
Anton Lokhmotov
Anton.Lokhmotov at arm.com
Wed Feb 23 09:29:55 PST 2011
Hi Guy,
I agree that vec_step should share code with sizeof and alignof. (Khronos
folks tried AltiVec compilers and concluded that vec_step wouldn't evaluate
its operand, just as sizeof.)
Will your implementation reject e.g. C structures and OpenCL image types?
Please see my comments on diagnostics below. Please also watch out for
mixed (Unix/Dos) line endings.
Cheers,
Anton.
P.S. I'll reply to you and Tanya soon with my view on supporting as_type and
convert_type built-in functions (yes, I think they are functions, not
operators).
> Index: include/clang/Basic/DiagnosticSemaKinds.td
> ===================================================================
...
> // Expressions.
> -def ext_sizeof_function_type : Extension<
> - "invalid application of 'sizeof' to a function type">,
InGroup<PointerArith>;
> +def ext_sizeof_vecstep_function_type : Extension<
> + "invalid application of '%select{sizeof|vec_step}0' to a function
type">,
> + InGroup<PointerArith>;
OK.
> def err_sizeof_alignof_overloaded_function_type : Error<
> - "invalid application of '%select{sizeof|__alignof}0' to an overloaded "
> - "function">;
> + "invalid application of '%select{sizeof|__alignof|vec_step}0' to an "
> + "overloaded function">;
The error name should be
err_sizeof_alignof_vecstep_overloaded_function_type? (But I'm curious why
one can apply alignof to a function type, but not to an overloaded
function?)
> def ext_sizeof_void_type : Extension<
> - "invalid application of '%0' to a void type">, InGroup<PointerArith>;
> + "invalid application of '%select{sizeof|__alignof|vec_step}0' to a void
"
> + "type">, InGroup<PointerArith>;
err_sizeof_alignof_vecstep_void_type?
> def err_sizeof_alignof_incomplete_type : Error<
> - "invalid application of '%select{sizeof|__alignof}0' to an incomplete
type %1">;
> + "invalid application of '%select{sizeof|__alignof|vec_step}0' to an "
> + "incomplete type %1">;
err_sizeof_alignof_vecstep_incomplete_type?
> +def err_vecstep_derived_type : Error<
> + "invalid application of vec_step to derived type %0">;
"to a derived type" (for consistency with "to an incomplete type" or "to a
void type" above)
More information about the cfe-dev
mailing list