<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Rewriter::getRangeSize wrong on Comments"
href="https://bugs.llvm.org/show_bug.cgi?id=41944">41944</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Rewriter::getRangeSize wrong on Comments
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>libclang
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>m_engel@cs.uni-kl.de
</td>
</tr>
<tr>
<th>CC</th>
<td>klimek@google.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>I registered a CommentHandler::HandleComment(Preprocessor & PP, SourceRange
Comment) to the preprocessor.
When it is called and I ask Rewriter::getRangeSize(Comment, /* any options */)
about the size, it is wrong if the comment is followed by another token
immediately.
Case 1: int x = 5 /* test */ ;
Case 2: int y = 5 /* test */;
In case 1, everything works fine.
In case 2, however, the semicolon is reported within the size, which is caused
by the Lexer::MeasureTokenLength call in getRangeSize.
So either Rewriter::getRangeSize or Lexer::MeasureTokenLength is messing things
up here. Unfortunately I'm not deep enough in the code to narrow it down any
further.</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>