-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
clang:as-a-librarylibclang and C++ APIlibclang and C++ APIclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
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;
}
Metadata
Metadata
Assignees
Labels
clang:as-a-librarylibclang and C++ APIlibclang and C++ APIclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"