Rename private member variables

This commit is contained in:
Daniel Marjamäki 2018-06-17 18:58:27 +02:00
parent 965fcf9303
commit 2a495184d2
2 changed files with 26 additions and 26 deletions

View File

@ -73,9 +73,9 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
continue; continue;
} }
_functionDecl.emplace_back(func); mFunctionDecl.emplace_back(func);
FunctionUsage &usage = _functions[func->name()]; FunctionUsage &usage = mFunctions[func->name()];
if (!usage.lineNumber) if (!usage.lineNumber)
usage.lineNumber = func->token->linenr(); usage.lineNumber = func->token->linenr();
@ -112,11 +112,11 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
} else if (markupVarToken->str() == settings->library.blockend(FileName)) } else if (markupVarToken->str() == settings->library.blockend(FileName))
scope--; scope--;
else if (!settings->library.iskeyword(FileName, markupVarToken->str())) { else if (!settings->library.iskeyword(FileName, markupVarToken->str())) {
_functionCalls.insert(markupVarToken->str()); mFunctionCalls.insert(markupVarToken->str());
if (_functions.find(markupVarToken->str()) != _functions.end()) if (mFunctions.find(markupVarToken->str()) != mFunctions.end())
_functions[markupVarToken->str()].usedOtherFile = true; mFunctions[markupVarToken->str()].usedOtherFile = true;
else if (markupVarToken->next()->str() == "(") { else if (markupVarToken->next()->str() == "(") {
FunctionUsage &func = _functions[markupVarToken->str()]; FunctionUsage &func = mFunctions[markupVarToken->str()];
func.filename = tokenizer.list.getSourceFilePath(); func.filename = tokenizer.list.getSourceFilePath();
if (func.filename.empty() || func.filename == "+") if (func.filename.empty() || func.filename == "+")
func.usedOtherFile = true; func.usedOtherFile = true;
@ -135,18 +135,18 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
if (settings->library.isexportedprefix(tok->str(), propToken->str())) { if (settings->library.isexportedprefix(tok->str(), propToken->str())) {
const Token* nextPropToken = propToken->next(); const Token* nextPropToken = propToken->next();
const std::string& value = nextPropToken->str(); const std::string& value = nextPropToken->str();
if (_functions.find(value) != _functions.end()) { if (mFunctions.find(value) != mFunctions.end()) {
_functions[value].usedOtherFile = true; mFunctions[value].usedOtherFile = true;
} }
_functionCalls.insert(value); mFunctionCalls.insert(value);
} }
if (settings->library.isexportedsuffix(tok->str(), propToken->str())) { if (settings->library.isexportedsuffix(tok->str(), propToken->str())) {
const Token* prevPropToken = propToken->previous(); const Token* prevPropToken = propToken->previous();
const std::string& value = prevPropToken->str(); const std::string& value = prevPropToken->str();
if (value != ")" && _functions.find(value) != _functions.end()) { if (value != ")" && mFunctions.find(value) != mFunctions.end()) {
_functions[value].usedOtherFile = true; mFunctions[value].usedOtherFile = true;
} }
_functionCalls.insert(value); mFunctionCalls.insert(value);
} }
propToken = propToken->next(); propToken = propToken->next();
} }
@ -159,8 +159,8 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
while (propToken && propToken->str() != ")") { while (propToken && propToken->str() != ")") {
const std::string& value = propToken->str(); const std::string& value = propToken->str();
if (!value.empty()) { if (!value.empty()) {
_functions[value].usedOtherFile = true; mFunctions[value].usedOtherFile = true;
_functionCalls.insert(value); mFunctionCalls.insert(value);
break; break;
} }
propToken = propToken->next(); propToken = propToken->next();
@ -185,8 +185,8 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
} }
if (index == argIndex) { if (index == argIndex) {
value = value.substr(1, value.length() - 2); value = value.substr(1, value.length() - 2);
_functions[value].usedOtherFile = true; mFunctions[value].usedOtherFile = true;
_functionCalls.insert(value); mFunctionCalls.insert(value);
} }
} }
} }
@ -223,7 +223,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
} }
if (funcname) { if (funcname) {
FunctionUsage &func = _functions[ funcname->str()]; FunctionUsage &func = mFunctions[ funcname->str()];
const std::string& called_from_file = tokenizer.list.getSourceFilePath(); const std::string& called_from_file = tokenizer.list.getSourceFilePath();
if (func.filename.empty() || func.filename == "+" || func.filename != called_from_file) if (func.filename.empty() || func.filename == "+" || func.filename != called_from_file)
@ -231,7 +231,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
else else
func.usedSameFile = true; func.usedSameFile = true;
_functionCalls.insert(funcname->str()); mFunctionCalls.insert(funcname->str());
} }
} }
} }
@ -289,7 +289,7 @@ static bool isOperatorFunction(const std::string & funcName)
bool CheckUnusedFunctions::check(ErrorLogger * const errorLogger, const Settings& settings) bool CheckUnusedFunctions::check(ErrorLogger * const errorLogger, const Settings& settings)
{ {
bool errors = false; bool errors = false;
for (std::map<std::string, FunctionUsage>::const_iterator it = _functions.begin(); it != _functions.end(); ++it) { for (std::map<std::string, FunctionUsage>::const_iterator it = mFunctions.begin(); it != mFunctions.end(); ++it) {
const FunctionUsage &func = it->second; const FunctionUsage &func = it->second;
if (func.usedOtherFile || func.filename.empty()) if (func.usedOtherFile || func.filename.empty())
continue; continue;
@ -360,12 +360,12 @@ 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 = _functionDecl.begin(); it != _functionDecl.end(); ++it) { for (std::list<FunctionDecl>::const_iterator it = mFunctionDecl.begin(); it != mFunctionDecl.end(); ++it) {
ret << " <functiondecl" ret << " <functiondecl"
<< " functionName=\"" << ErrorLogger::toxml(it->functionName) << '\"' << " functionName=\"" << ErrorLogger::toxml(it->functionName) << '\"'
<< " lineNumber=\"" << it->lineNumber << "\"/>\n"; << " lineNumber=\"" << it->lineNumber << "\"/>\n";
} }
for (std::set<std::string>::const_iterator it = _functionCalls.begin(); it != _functionCalls.end(); ++it) { for (std::set<std::string>::const_iterator it = mFunctionCalls.begin(); it != mFunctionCalls.end(); ++it) {
ret << " <functioncall functionName=\"" << ErrorLogger::toxml(*it) << "\"/>\n"; ret << " <functioncall functionName=\"" << ErrorLogger::toxml(*it) << "\"/>\n";
} }
return ret.str(); return ret.str();

View File

@ -51,8 +51,8 @@ public:
} }
static void clear() { static void clear() {
instance._functions.clear(); instance.mFunctions.clear();
instance._functionCalls.clear(); instance.mFunctionCalls.clear();
} }
// Parse current tokens and determine.. // Parse current tokens and determine..
@ -115,7 +115,7 @@ private:
bool usedOtherFile; bool usedOtherFile;
}; };
std::map<std::string, FunctionUsage> _functions; std::map<std::string, FunctionUsage> mFunctions;
class CPPCHECKLIB FunctionDecl { class CPPCHECKLIB FunctionDecl {
public: public:
@ -123,8 +123,8 @@ private:
std::string functionName; std::string functionName;
unsigned int lineNumber; unsigned int lineNumber;
}; };
std::list<FunctionDecl> _functionDecl; std::list<FunctionDecl> mFunctionDecl;
std::set<std::string> _functionCalls; std::set<std::string> mFunctionCalls;
}; };
/// @} /// @}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------