From 6fcef867a1c8a7520c5b8a8d8ed549ef503f7343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 27 Apr 2019 17:04:14 +0200 Subject: [PATCH] Refactoring; use range for loops --- lib/checkunusedfunctions.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index 051a44562..e4add4ca8 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -54,8 +54,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi const SymbolDatabase* symbolDatabase = tokenizer.getSymbolDatabase(); // Function declarations.. - for (std::size_t i = 0; i < symbolDatabase->functionScopes.size(); i++) { - const Scope* scope = symbolDatabase->functionScopes[i]; + for (const Scope* scope : symbolDatabase->functionScopes) { const Function* func = scope->function; if (!func || !func->token || scope->bodyStart->fileIndex() != 0) continue; @@ -361,13 +360,13 @@ CheckUnusedFunctions::FunctionDecl::FunctionDecl(const Function *f) std::string CheckUnusedFunctions::analyzerInfo() const { std::ostringstream ret; - for (std::list::const_iterator it = mFunctionDecl.begin(); it != mFunctionDecl.end(); ++it) { + for (const FunctionDecl &functionDecl : mFunctionDecl) { ret << " functionName) << '\"' - << " lineNumber=\"" << it->lineNumber << "\"/>\n"; + << " functionName=\"" << ErrorLogger::toxml(functionDecl.functionName) << '\"' + << " lineNumber=\"" << functionDecl.lineNumber << "\"/>\n"; } - for (std::set::const_iterator it = mFunctionCalls.begin(); it != mFunctionCalls.end(); ++it) { - ret << " \n"; + for (const std::string &fc : mFunctionCalls) { + ret << " \n"; } return ret.str(); }