Refactoring; use range for loops
This commit is contained in:
parent
b5ee9d97ef
commit
6fcef867a1
|
@ -54,8 +54,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
|
||||||
const SymbolDatabase* symbolDatabase = tokenizer.getSymbolDatabase();
|
const SymbolDatabase* symbolDatabase = tokenizer.getSymbolDatabase();
|
||||||
|
|
||||||
// Function declarations..
|
// Function declarations..
|
||||||
for (std::size_t i = 0; i < symbolDatabase->functionScopes.size(); i++) {
|
for (const Scope* scope : symbolDatabase->functionScopes) {
|
||||||
const Scope* scope = symbolDatabase->functionScopes[i];
|
|
||||||
const Function* func = scope->function;
|
const Function* func = scope->function;
|
||||||
if (!func || !func->token || scope->bodyStart->fileIndex() != 0)
|
if (!func || !func->token || scope->bodyStart->fileIndex() != 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -361,13 +360,13 @@ CheckUnusedFunctions::FunctionDecl::FunctionDecl(const Function *f)
|
||||||
std::string CheckUnusedFunctions::analyzerInfo() const
|
std::string CheckUnusedFunctions::analyzerInfo() const
|
||||||
{
|
{
|
||||||
std::ostringstream ret;
|
std::ostringstream ret;
|
||||||
for (std::list<FunctionDecl>::const_iterator it = mFunctionDecl.begin(); it != mFunctionDecl.end(); ++it) {
|
for (const FunctionDecl &functionDecl : mFunctionDecl) {
|
||||||
ret << " <functiondecl"
|
ret << " <functiondecl"
|
||||||
<< " functionName=\"" << ErrorLogger::toxml(it->functionName) << '\"'
|
<< " functionName=\"" << ErrorLogger::toxml(functionDecl.functionName) << '\"'
|
||||||
<< " lineNumber=\"" << it->lineNumber << "\"/>\n";
|
<< " lineNumber=\"" << functionDecl.lineNumber << "\"/>\n";
|
||||||
}
|
}
|
||||||
for (std::set<std::string>::const_iterator it = mFunctionCalls.begin(); it != mFunctionCalls.end(); ++it) {
|
for (const std::string &fc : mFunctionCalls) {
|
||||||
ret << " <functioncall functionName=\"" << ErrorLogger::toxml(*it) << "\"/>\n";
|
ret << " <functioncall functionName=\"" << ErrorLogger::toxml(fc) << "\"/>\n";
|
||||||
}
|
}
|
||||||
return ret.str();
|
return ret.str();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue