Refactor lib/checkunusedvar.cpp

This commit is contained in:
jrp2014 2018-04-06 08:07:15 +02:00 committed by Daniel Marjamäki
parent d2160f00b2
commit 034296039c
1 changed files with 5 additions and 15 deletions

View File

@ -230,9 +230,7 @@ void Variables::eraseAliases(unsigned int varid)
VariableUsage *usage = find(varid);
if (usage) {
std::set<unsigned int>::const_iterator aliases;
for (aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases)
for (std::set<unsigned int>::const_iterator aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases)
erase(*aliases);
}
}
@ -280,9 +278,7 @@ void Variables::readAliases(unsigned int varid, const Token* tok)
VariableUsage *usage = find(varid);
if (usage) {
std::set<unsigned int>::iterator aliases;
for (aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases) {
for (std::set<unsigned int>::iterator aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases) {
VariableUsage *aliased = find(*aliases);
if (aliased) {
@ -317,9 +313,7 @@ void Variables::writeAliases(unsigned int varid, const Token* tok)
VariableUsage *usage = find(varid);
if (usage) {
std::set<unsigned int>::const_iterator aliases;
for (aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases) {
for (std::set<unsigned int>::const_iterator aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases) {
VariableUsage *aliased = find(*aliases);
if (aliased) {
@ -344,9 +338,7 @@ void Variables::use(unsigned int varid, const Token* tok)
usage->use(_varReadInScope);
usage->_lastAccess = tok;
std::set<unsigned int>::const_iterator aliases;
for (aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases) {
for (std::set<unsigned int>::const_iterator aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases) {
VariableUsage *aliased = find(*aliases);
if (aliased) {
@ -367,9 +359,7 @@ void Variables::modified(unsigned int varid, const Token* tok)
usage->_modified = true;
usage->_lastAccess = tok;
std::set<unsigned int>::const_iterator aliases;
for (aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases) {
for (std::set<unsigned int>::const_iterator aliases = usage->_aliases.begin(); aliases != usage->_aliases.end(); ++aliases) {
VariableUsage *aliased = find(*aliases);
if (aliased) {