Remove old pointer alias check (#3983)
This commit is contained in:
parent
52b4aeb279
commit
4c1aeb0cb1
|
@ -5248,14 +5248,7 @@ static void valueFlowAfterAssign(TokenList *tokenlist, SymbolDatabase* symboldat
|
||||||
{
|
{
|
||||||
for (const Scope * scope : symboldatabase->functionScopes) {
|
for (const Scope * scope : symboldatabase->functionScopes) {
|
||||||
std::unordered_map<nonneg int, std::unordered_set<nonneg int>> backAssigns;
|
std::unordered_map<nonneg int, std::unordered_set<nonneg int>> backAssigns;
|
||||||
std::set<nonneg int> aliased;
|
|
||||||
for (Token* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
for (Token* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||||
// Alias
|
|
||||||
if (tok->isUnaryOp("&")) {
|
|
||||||
aliased.insert(tok->astOperand1()->exprId());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assignment
|
// Assignment
|
||||||
if ((tok->str() != "=" && !isVariableInit(tok)) || (tok->astParent()))
|
if ((tok->str() != "=" && !isVariableInit(tok)) || (tok->astParent()))
|
||||||
continue;
|
continue;
|
||||||
|
@ -5263,9 +5256,6 @@ static void valueFlowAfterAssign(TokenList *tokenlist, SymbolDatabase* symboldat
|
||||||
// Lhs should be a variable
|
// Lhs should be a variable
|
||||||
if (!tok->astOperand1() || !tok->astOperand1()->exprId())
|
if (!tok->astOperand1() || !tok->astOperand1()->exprId())
|
||||||
continue;
|
continue;
|
||||||
const nonneg int exprid = tok->astOperand1()->exprId();
|
|
||||||
if (aliased.find(exprid) != aliased.end())
|
|
||||||
continue;
|
|
||||||
std::vector<const Variable*> vars = getLHSVariables(tok);
|
std::vector<const Variable*> vars = getLHSVariables(tok);
|
||||||
|
|
||||||
// Rhs values..
|
// Rhs values..
|
||||||
|
|
|
@ -305,6 +305,7 @@ void validCode()
|
||||||
wordInit = HIWORD(dwordInit);
|
wordInit = HIWORD(dwordInit);
|
||||||
// cppcheck-suppress redundantAssignment
|
// cppcheck-suppress redundantAssignment
|
||||||
byteInit = HIBYTE(wordInit);
|
byteInit = HIBYTE(wordInit);
|
||||||
|
// cppcheck-suppress knownConditionTrueFalse
|
||||||
if (byteInit) {}
|
if (byteInit) {}
|
||||||
|
|
||||||
bool boolVar;
|
bool boolVar;
|
||||||
|
|
Loading…
Reference in New Issue