Anastasia added a comment.

It would be good to test your `CIndex` changes in `test/Index/opencl-types.cl`.



================
Comment at: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl:26
+         char4 c4, event_t e, struct st ss) {
+  intel_sub_group_avc_mce_payload_t payload_mce = 0; // No zero initializer 
for mce types
+  // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with 
an expression of incompatible type 'int'}}
----------------
AlexeySachkov wrote:
> Anastasia wrote:
> > Would it make sense to add a check for non-zero constant?
> > 
> > Also can you assign variables of intel_sub_group_avc_mce_payload_t type 
> > from the same type? Any other restrictions on assignment (i.e. w integer 
> > literals) and operations over these types?
> > Also can you assign variables of intel_sub_group_avc_mce_payload_t type 
> > from the same type?
> 
> Yes, such assignment is allowed.
> 
> > Any other restrictions on assignment (i.e. w integer literals)
> 
> All of these types can only be initialized using call to a special built-ins 
> or using predefined macros like `CLK_AVC_REF_RESULT_INITIALIZE_INTEL`. Any 
> other assignment should lead to an error. 
> 
> I found that I'm able to assign variable of type 
> `intel_sub_group_avc_imc_payload_t` to variable of type 
> `intel_sub_group_avc_mce_payload_t`, so I will update the patch when I 
> implement such diagnostic message.
> 
> > and operations over these types?
> Variables of these types can only be used as return values or arguments for 
> built-in functions described in the specification. All other operations are 
> restricted
W/o the spec change it's really difficult to review properly. So are you 
testing 2 groups of types:
1. Init by zero in `bar`?
2. Init by builtin function in `foo`?



================
Comment at: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl:34
+  // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with 
an expression of incompatible type 'int'}}
+  intel_sub_group_avc_ime_payload_t payload_ime = b;
+  // expected-error@-1 {{initializing 'intel_sub_group_avc_ime_payload_t' with 
an expression of incompatible type 'bool'}}
----------------
I am not sure it makes sense to iterate through all different types. You don't 
enumerate all of them and we don't do exhaustive testing in Clang tests anyway. 
I would just check integer literal and one other builtin type.


https://reviews.llvm.org/D51484



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to