<div dir="ltr">Hi,<div><br></div><div style>I'm getting some strange behaviour, when I'm trying to get source range for vector initalizations.</div><div style><br></div><div style>I have two different variable declarations:</div>
<div style><br></div><div style><div>__constant float4 base_factor = (float4)(1.0f,2.0f,3.0f,4.0f);</div><div>__constant float base_table[] = { 1.0f,2.0f,3.0f,4.0f };</div><div><br></div><div style>whose corresponding initializers are:</div>
<div style><br></div><div style><div><div>(InitListExpr 0x7f8a9bcd3cf0 'float4':'float __attribute__((ext_vector_type(4)))'</div><div>  (FloatingLiteral 0x7f8a9bcd3c18 'float' 1.000000e+00)</div><div>
  (FloatingLiteral 0x7f8a9bcd3c38 'float' 2.000000e+00)</div><div>  (FloatingLiteral 0x7f8a9bcd3c58 'float' 3.000000e+00)</div><div>  (FloatingLiteral 0x7f8a9bcd3c78 'float' 4.000000e+00))</div></div>
<div><br></div><div style>and:</div><div style><br></div><div style><div>(InitListExpr 0x7fb470cd3fe8 '__constant float [4]'</div><div>  (FloatingLiteral 0x7fb470cd3f08 'float' 1.000000e+00)</div><div>  (FloatingLiteral 0x7fb470cd3f28 'float' 2.000000e+00)</div>
<div>  (FloatingLiteral 0x7fb470cd3f48 'float' 3.000000e+00)</div><div>  (FloatingLiteral 0x7fb470cd3f68 'float' 4.000000e+00))</div><div><br></div></div><div style><div style>However when I'm trying to get them as string from rewriter with getRewrittenText<span class="">(init-></span>getSourceRange<span class="">())</span></div>
<div style><br></div><div style>I get:</div><div style><br></div><div style>(float4)</div><div style><br></div><div style>and</div><div style><br></div><div style>{ 1,2,3,4 }<br></div><div style><br></div><div style>So it seems that InitListExpr does not handle vector type initializations correctly. Or what am I doing wrong here?</div>
<div style><br></div><div style>Thanks, Mikael Lepistö</div></div></div></div></div>