exceptRethrowCopy: Fixed FP in Cppcheck

This commit is contained in:
Daniel Marjamäki 2020-06-22 12:26:41 +02:00
parent 41cb925440
commit ab14d2bc0f
2 changed files with 7 additions and 1 deletions

View File

@ -161,6 +161,12 @@ void CheckExceptionSafety::checkRethrowCopy()
tok = tok->next()->link()->next()->link();
if (!tok)
break;
} else if (Token::Match(tok, "%varid% .", varid)) {
const Token *parent = tok->astParent();
while (Token::simpleMatch(parent->astParent(), "."))
parent = parent->astParent();
if (Token::Match(parent->astParent(), "%assign%|++|--|(") && parent == parent->astParent()->astOperand1())
break;
} else if (Token::Match(tok, "throw %varid% ;", varid))
rethrowCopyError(tok, tok->strAt(1));
}

View File

@ -1836,7 +1836,7 @@ static ExprEngine::ValuePtr executeFunctionCall(const Token *tok, Data &data)
} catch (BugHuntingException &e) {
data.errorPath.pop_back();
e.tok = tok;
throw e; // cppcheck-suppress exceptRethrowCopy
throw e;
}
data.errorPath.pop_back();
}