<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - getSourceRange() for InitListExpr does not return full range for vector initliazation"
href="http://llvm.org/bugs/show_bug.cgi?id=16560">16560</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>getSourceRange() for InitListExpr does not return full range for vector initliazation
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mikael.lepisto@vincit.fi
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I'm getting some strange behaviour, when I'm trying to get source range for
vector initalizations.
I have declaration (in global scope):
__constant float4 base_factor = (float4)(1.0f,2.0f,3.0f,4.0f);
Which is parsed to following AST:
(InitListExpr 0x7f8a9bcd3cf0 'float4':'float
__attribute__((ext_vector_type(4)))'
(FloatingLiteral 0x7f8a9bcd3c18 'float' 1.000000e+00)
(FloatingLiteral 0x7f8a9bcd3c38 'float' 2.000000e+00)
(FloatingLiteral 0x7f8a9bcd3c58 'float' 3.000000e+00)
(FloatingLiteral 0x7f8a9bcd3c78 'float' 4.000000e+00))
However when I'm trying to get them as string from rewriter with
getRewrittenText(init->getSourceRange())
I get only the first parenthesis:
(float4)
As a comparison, when I test normal table initialization everything seems fine:
__constant float base_table[] = { 1.0f,2.0f,3.0f,4.0f };
(InitListExpr 0x7fb470cd3fe8 '__constant float [4]'
(FloatingLiteral 0x7fb470cd3f08 'float' 1.000000e+00)
(FloatingLiteral 0x7fb470cd3f28 'float' 2.000000e+00)
(FloatingLiteral 0x7fb470cd3f48 'float' 3.000000e+00)
(FloatingLiteral 0x7fb470cd3f68 'float' 4.000000e+00))
Source location returns: { 1,2,3,4 }
Sounds like a similar problem to <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - getSourceRange() doesn't contain full DeclStmt"
href="show_bug.cgi?id=3365">http://llvm.org/bugs/show_bug.cgi?id=3365</a> ,
which was fixed few years ago.
Thanks, Mikael</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>