Fixed a bug and two warnings introduced recently.

This commit is contained in:
PKEuS 2014-08-06 13:35:39 +02:00
parent c3577bc8dd
commit e4b55cf843
3 changed files with 4 additions and 5 deletions

View File

@ -2018,7 +2018,6 @@ void CheckClass::initializerListError(const Token *tok1, const Token *tok2, cons
void CheckClass::checkSelfInitialization() void CheckClass::checkSelfInitialization()
{ {
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
for (std::size_t i = 0; i < symbolDatabase->functionScopes.size(); ++i) { for (std::size_t i = 0; i < symbolDatabase->functionScopes.size(); ++i) {
const Scope* scope = symbolDatabase->functionScopes[i]; const Scope* scope = symbolDatabase->functionScopes[i];
const Function* function = scope->function; const Function* function = scope->function;
@ -2037,9 +2036,9 @@ void CheckClass::checkSelfInitialization()
} }
} }
void CheckClass::selfInitializationError(const Token* tok, const std::string& name) void CheckClass::selfInitializationError(const Token* tok, const std::string& varname)
{ {
reportError(tok, Severity::error, "selfInitialization", "Member variable '" + name + "' is initialized by itself."); reportError(tok, Severity::error, "selfInitialization", "Member variable '" + varname + "' is initialized by itself.");
} }

View File

@ -155,7 +155,7 @@ private:
void checkConstError2(const Token *tok1, const Token *tok2, const std::string &classname, const std::string &funcname, bool suggestStatic); void checkConstError2(const Token *tok1, const Token *tok2, const std::string &classname, const std::string &funcname, bool suggestStatic);
void initializerListError(const Token *tok1,const Token *tok2, const std::string & classname, const std::string &varname); void initializerListError(const Token *tok1,const Token *tok2, const std::string & classname, const std::string &varname);
void suggestInitializationList(const Token *tok, const std::string& varname); void suggestInitializationList(const Token *tok, const std::string& varname);
void selfInitializationError(const Token* tok, const std::string& name); void selfInitializationError(const Token* tok, const std::string& varname);
void callsPureVirtualFunctionError(const Function & scopeFunction, const std::list<const Token *> & tokStack, const std::string &purefuncname); void callsPureVirtualFunctionError(const Function & scopeFunction, const std::list<const Token *> & tokStack, const std::string &purefuncname);
void duplInheritedMembersError(const Token* tok1, const Token* tok2, const std::string &derivedname, const std::string &basename, const std::string &variablename, bool derivedIsStruct, bool baseIsStruct); void duplInheritedMembersError(const Token* tok1, const Token* tok2, const std::string &derivedname, const std::string &basename, const std::string &variablename, bool derivedIsStruct, bool baseIsStruct);

View File

@ -111,7 +111,7 @@ Token *Tokenizer::copyTokens(Token *dest, const Token *first, const Token *last,
tok2->fileIndex(commonFileIndex); tok2->fileIndex(commonFileIndex);
tok2->linenr(linenrs); tok2->linenr(linenrs);
tok2->type(tok->type()); tok2->type(tok->type());
tok2->flags(tok2->flags()); tok2->flags(tok->flags());
tok2->varId(tok->varId()); tok2->varId(tok->varId());
// Check for links and fix them up // Check for links and fix them up