Skip to content

Commit 4359762

Browse files
committed
fixed modernize-use-auto clang-tidy warnings
1 parent 511ed95 commit 4359762

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

lib/checkstl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,8 +2039,8 @@ void CheckStl::string_c_str()
20392039
string_c_strAssignment(tok, tok->variable()->getTypeName());
20402040
}
20412041
} else if (printPerformance && tok->function() && Token::Match(tok, "%name% ( !!)") && tok->str() != scope.className) {
2042-
const auto range = c_strFuncParam.equal_range(tok->function());
2043-
for (std::multimap<const Function*, StrArg>::const_iterator i = range.first; i != range.second; ++i) {
2042+
const auto range = utils::as_const(c_strFuncParam).equal_range(tok->function());
2043+
for (auto i = range.first; i != range.second; ++i) {
20442044
if (i->second.n == 0)
20452045
continue;
20462046

lib/preprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ static void getConfigs(const simplecpp::TokenList &tokens, std::set<std::string>
620620
{
621621
const std::string::size_type eq = config.find('=');
622622
const std::string config2 = (eq != std::string::npos) ? config.substr(0, eq) : config + "=" + config;
623-
const std::set<std::string>::iterator it2 = ret.find(config2);
623+
const auto it2 = utils::as_const(ret).find(config2);
624624
if (it2 != ret.end()) {
625625
if (eq == std::string::npos) {
626626
// The instance in ret is more specific than the one in config (no =value), replace it with the one in config

lib/symboldatabase.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,8 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
721721
}
722722

723723
bool newFunc = true; // Is this function already in the database?
724-
auto range = scope->functionMap.equal_range(tok->str());
725-
for (std::multimap<std::string, const Function*>::const_iterator it = range.first; it != range.second; ++it) {
724+
auto range = utils::as_const(scope->functionMap).equal_range(tok->str());
725+
for (auto it = range.first; it != range.second; ++it) {
726726
if (it->second->argsMatch(scope, it->second->argDef, argStart, "", 0)) {
727727
newFunc = false;
728728
break;
@@ -805,8 +805,8 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
805805
if (isFunction(ftok, scope, funcStart, argStart, declEnd)) {
806806
if (declEnd && declEnd->str() == ";") {
807807
bool newFunc = true; // Is this function already in the database?
808-
auto range = scope->functionMap.equal_range(ftok->str());
809-
for (std::multimap<std::string, const Function*>::const_iterator it = range.first; it != range.second; ++it) {
808+
auto range = utils::as_const(scope->functionMap).equal_range(ftok->str());
809+
for (auto it = range.first; it != range.second; ++it) {
810810
if (it->second->argsMatch(scope, it->second->argDef, argStart, "", 0)) {
811811
newFunc = false;
812812
break;
@@ -3449,8 +3449,8 @@ Function* SymbolDatabase::addGlobalFunction(Scope*& scope, const Token*& tok, co
34493449
Function* function = nullptr;
34503450
// Lambda functions are always unique
34513451
if (tok->str() != "[") {
3452-
auto range = scope->functionMap.equal_range(tok->str());
3453-
for (std::multimap<std::string, const Function*>::const_iterator it = range.first; it != range.second; ++it) {
3452+
auto range = utils::as_const(scope->functionMap).equal_range(tok->str());
3453+
for (auto it = range.first; it != range.second; ++it) {
34543454
const Function *f = it->second;
34553455
if (f->hasBody())
34563456
continue;
@@ -3609,8 +3609,8 @@ void SymbolDatabase::addClassFunction(Scope *&scope, const Token *&tok, const To
36093609
}
36103610

36113611
if (match) {
3612-
auto range = scope1->functionMap.equal_range(tok->str());
3613-
for (std::multimap<std::string, const Function*>::const_iterator it = range.first; it != range.second; ++it) {
3612+
auto range = utils::as_const(scope1->functionMap).equal_range(tok->str());
3613+
for (auto it = range.first; it != range.second; ++it) {
36143614
auto * func = const_cast<Function *>(it->second);
36153615
if (destructor && func->type != FunctionType::eDestructor)
36163616
continue;

0 commit comments

Comments
 (0)