<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJzNVd9vmzAQ_mvg5RRETKDJAw9pQqRqmSolXffMDwOuHBzZJl3--50NaaBd106TpiELA3e---7u4y4TxTnOedpUDtlwluE9KZjuN1rsRStz6uXHo-OvHX_Z3VfiRCXTZ2AKnlPZsKaCNBOthhRaRTlVCvKUc9ACYNXKpCm8iurvTNf3Zako2p-nufZ29ICWtrRxyALwG9MKRMPPxkjZciiFBPNNUt3KBk4pb6lDVvBcs7w2zlnVCEkLD88P8TmR3y_7ehKsgGE8TrDElR6P_LyjzxgJVejdaKgdzSnD6BBOJPtndNkZgo-uTAgOqhYtL5bFU6u0jTDlygZ4c3sx43XXEDPYaBHGhnFqoTycO5wIT6YahQk4wRpe5B5tCtQ3sQe3cIdnp0aemDeH3OK6e-UW7OGuBCBwswbvJk6QlEwqjSfHqsYPYKWueormAt0OFVOlqDQl7S0mRrmreodtHCYAK-GqvR5pj9EC7LV8pLkNB9UMZx7ojzFOyzDk0FDpSqw3mp_hoskgmtvgQoQrXBO84Ns-2Sb7PayW2-3QKmZEswapOXTm3Kxfxz0kHHod0KuP0zwhRIOrf7R4UGxp-7Wyulv8W--PWr1Py3cYOMLX-7GVNaUYCS9pfy_nl4z_Nt1dsqGvr3H2JvGXCIfQ3iTuH6Xto6RdcY27y96eA11jP8psa_mV1v_Ae7i6_Mwv8AcUv8TqFnFQLIJF6qatroWMd1_27CAat5U8rrU-KpMf-2NV6L3NvFwczOThp8s2OUrxRHMzgphSrenMmzCYkcitY5KVYVlG03kYlAs_8ou8jPKAzCn1o9k8ylyeZpSr2Amx-5FurAXLUiJ42yuJ4QFuOOj6mUeccO3-PTQWE58Qf0oQG5lOb7xsEc3DRUhmkV-Gs7J0Zj49pIx7xo4nZOXK2JrM2kqhkDOFDf1FiC0VRxulNhJEqJnm9qWDHa4_GmcwGQ1i1-KNLdifUE1P1A>53426</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] EditedSource::applyRewrites - useless call
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
libclang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RKSimon
</td>
</tr>
</table>
<pre>
clang/lib/Edit/EditedSource.cpp
Coverity is warning about a useless call to CurEnd.getWithOffset(act.RemoveLen) (its only useful for its return value, which is ignored.)
```
void EditedSource::applyRewrites(EditsReceiver &receiver,
bool shouldAdjustRemovals) {
.......
for (FileEditsTy::iterator E = FileEdits.end(); I != E; ++I) {
FileOffset offs = I->first;
FileEdit act = I->second;
assert(offs >= CurEnd);
if (offs == CurEnd) {
StrVec += act.Text;
CurLen += act.RemoveLen;
CurEnd.getWithOffset(act.RemoveLen); // <<---- USELESS CALL
continue;
}
applyRewrite(receiver, StrVec, CurOffs, CurLen, SourceMgr, LangOpts,
shouldAdjustRemovals);
CurOffs = offs;
StrVec = act.Text;
CurLen = act.RemoveLen;
CurEnd = CurOffs.getWithOffset(CurLen);
}
applyRewrite(receiver, StrVec, CurOffs, CurLen, SourceMgr, LangOpts,
shouldAdjustRemovals);
}
```
Should this be:
```
if (offs == CurEnd) {
StrVec += act.Text;
CurLen += act.RemoveLen;
CurEnd = CurEnd.getWithOffset(act.RemoveLen);
continue;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVd9vmzAQ_mvIyymImIQ0DzzkB5GqZaqUdNuzAQOuHBzZJl3--50NaaBd1-5lGrIwcOe777s77lKZX-JM0Lr0yFbwFO9Jzk23sfwgG5UxPzudvGDjBcv2vpZnpri5ANfwTFXN6xJoKhsDFBrNBNMaMioEGAmwblRS537JzA9uqoei0Azt39HM-Ht2REs7VntkAfiNGw2yFhdrpGgEFFKB_aaYaVQNZyoa5pE1PFc8q6xzXtZSsdzH8318XhR0y72eJc-hz8cLl7jo6SQue_aMTJhG71ZD71nGOLJDOJHqntFlawg-ulIpBehKNiJf5k-NNo4hFdoRnK-uZvz26mMGxxZhbLlgDsrjpcWJ8BQ1KEzACzfwIvdZnaO-5R6u4B7PTqw8sW8eWeG6f-UW3OE2BSBxcwbvx16YFFxpgyeHqtYPYKZuepplEt32FanWTNmUdhYTq9xmvcU2pAnAC7hpbwbaQ7QAB6O-s8zRQTVbM4_s5xCnqzCsob7SrbDeaH6mFm0E0dwWFyJc4xrjBd8OyS45HGC93O36VjEihtdYmn1n3nzzmne_4NBrr7w6nvYJIVpc3aPDg2JXtl9Lp7vDv_XhZPT7ZflOBQ7wdX5cZm0qBsJr2N-L-TXifwx3G2zo8mudvQn8lWEf2pvA_aOwfRS0G65hdzm4c2Aq7Eepay2_0_of6h5uLj_zC_xFiV-5jvI4zBfhgo4MN4LF3mzVDpfZ5qMGDOPB6Bg1SsSVMSdtdd2vWCLeJvUzebSzSpyv2_ik5BPL7NDiWje2l29n4ZREoyomtCiyyYKk8yibRXM6z4NwEhYRjbIFCxGwoCkT2gL1CGmxhstCIV3XXYmtHNxwNHZTkiCXEY9JQEgwIdHkjkwmcz9dRHezxYxMo6CYTYvCmwbsSLnwLUBfqnKkYoc1bUqNQsE1NvAXIbZQHGXMBczap42ppIr3Xw78KOuRoxU7Tr8A3j86VQ">