Improved const correctness of local variables.
This commit is contained in:
parent
7d4a80fbd2
commit
de66eedd54
|
@ -1775,13 +1775,13 @@ void TemplateSimplifier::simplifyTemplates(
|
||||||
for (std::list<TokenAndName>::const_iterator iter2 = templateDeclarations.begin(); iter2 != templateDeclarations.end(); ++iter2) {
|
for (std::list<TokenAndName>::const_iterator iter2 = templateDeclarations.begin(); iter2 != templateDeclarations.end(); ++iter2) {
|
||||||
if (iter1->name == iter2->name) {
|
if (iter1->name == iter2->name) {
|
||||||
const Token *tok = iter2->token->next()->findClosingBracket();
|
const Token *tok = iter2->token->next()->findClosingBracket();
|
||||||
int namepos = getTemplateNamePosition(tok);
|
const int namepos = getTemplateNamePosition(tok);
|
||||||
if (namepos > 0)
|
if (namepos > 0)
|
||||||
specializations.push_back(tok->tokAt(namepos));
|
specializations.push_back(tok->tokAt(namepos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool instantiated = TemplateSimplifier::simplifyTemplateInstantiations(tokenlist,
|
const bool instantiated = TemplateSimplifier::simplifyTemplateInstantiations(tokenlist,
|
||||||
errorlogger,
|
errorlogger,
|
||||||
_settings,
|
_settings,
|
||||||
*iter1,
|
*iter1,
|
||||||
|
|
|
@ -1522,7 +1522,7 @@ const Token *Token::getValueTokenMinStrSize() const
|
||||||
std::list<ValueFlow::Value>::const_iterator it;
|
std::list<ValueFlow::Value>::const_iterator it;
|
||||||
for (it = _values->begin(); it != _values->end(); ++it) {
|
for (it = _values->begin(); it != _values->end(); ++it) {
|
||||||
if (it->isTokValue() && it->tokvalue && it->tokvalue->tokType() == Token::eString) {
|
if (it->isTokValue() && it->tokvalue && it->tokvalue->tokType() == Token::eString) {
|
||||||
std::size_t size = getStrSize(it->tokvalue);
|
const std::size_t size = getStrSize(it->tokvalue);
|
||||||
if (!ret || size < minsize) {
|
if (!ret || size < minsize) {
|
||||||
minsize = size;
|
minsize = size;
|
||||||
ret = it->tokvalue;
|
ret = it->tokvalue;
|
||||||
|
@ -1541,7 +1541,7 @@ const Token *Token::getValueTokenMaxStrLength() const
|
||||||
std::list<ValueFlow::Value>::const_iterator it;
|
std::list<ValueFlow::Value>::const_iterator it;
|
||||||
for (it = _values->begin(); it != _values->end(); ++it) {
|
for (it = _values->begin(); it != _values->end(); ++it) {
|
||||||
if (it->isTokValue() && it->tokvalue && it->tokvalue->tokType() == Token::eString) {
|
if (it->isTokValue() && it->tokvalue && it->tokvalue->tokType() == Token::eString) {
|
||||||
std::size_t length = getStrLength(it->tokvalue);
|
const std::size_t length = getStrLength(it->tokvalue);
|
||||||
if (!ret || length > maxlength) {
|
if (!ret || length > maxlength) {
|
||||||
maxlength = length;
|
maxlength = length;
|
||||||
ret = it->tokvalue;
|
ret = it->tokvalue;
|
||||||
|
|
|
@ -2620,7 +2620,7 @@ static void valueFlowAfterCondition(TokenList *tokenlist, SymbolDatabase* symbol
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dead_if = isReturnScope(after);
|
const bool dead_if = isReturnScope(after);
|
||||||
bool dead_else = false;
|
bool dead_else = false;
|
||||||
|
|
||||||
if (Token::simpleMatch(after, "} else {")) {
|
if (Token::simpleMatch(after, "} else {")) {
|
||||||
|
|
Loading…
Reference in New Issue