improve unusedfields loplugin

to ignore assignments when doing writeonly analysis

Change-Id: I9eb6f2594003a610582dbc20acb7ccf14ef72c6c
This commit is contained in:
Noel Grandin
2017-06-15 09:49:05 +02:00
parent 416752b9e4
commit 2c83c40b43
2 changed files with 34 additions and 10 deletions

View File

@@ -194,8 +194,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt)
return checkIfCanBeConst(parent);
}
return true;
} else if (isa<BinaryOperator>(parent)) {
const BinaryOperator* binaryOp = dyn_cast<BinaryOperator>(parent);
} else if (auto binaryOp = dyn_cast<BinaryOperator>(parent)) {
BinaryOperator::Opcode op = binaryOp->getOpcode();
// TODO could do better, but would require tracking the LHS
if (binaryOp->getRHS() == stmt && op == BO_Assign) {