Fixed: lib/checkclass.cpp:538:85: warning: declaration of ‘name’ shadows a member of 'this'.

This commit is contained in:
Edoardo Prezioso 2012-05-19 21:51:39 +02:00
parent be7b104a8e
commit 892c125ff8
2 changed files with 4 additions and 4 deletions

View File

@ -535,12 +535,12 @@ void CheckClass::initializationListUsage()
}
}
void CheckClass::suggestInitializationList(const Token* tok, const std::string& name)
void CheckClass::suggestInitializationList(const Token* tok, const std::string& varname)
{
reportError(tok, Severity::performance, "useInitializationList", "Variable '" + name + "' is assigned in constructor body. Consider to perform initalization in initialization list.\n"
reportError(tok, Severity::performance, "useInitializationList", "Variable '" + varname + "' is assigned in constructor body. Consider to perform initalization in initialization list.\n"
"When an object of a class is created, the constructors of all member variables are called consecutivly "
"in the order the variables are declared, even if you don't explicitly write them to the initialization list. You "
"could avoid assigning '" + name + "' a value by passing the value to the constructor in the initialization list.");
"could avoid assigning '" + varname + "' a value by passing the value to the constructor in the initialization list.");
}
//---------------------------------------------------------------------------

View File

@ -125,7 +125,7 @@ private:
void checkConstError(const Token *tok, const std::string &classname, const std::string &funcname);
void checkConstError2(const Token *tok1, const Token *tok2, const std::string &classname, const std::string &funcname);
void initializerListError(const Token *tok1,const Token *tok2, const std::string & classname, const std::string &varname);
void suggestInitializationList(const Token *tok, const std::string& name);
void suggestInitializationList(const Token *tok, const std::string& varname);
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const {
CheckClass c(0, settings, errorLogger);