Use reference instead of string copy (fixes some --style warnings from our code)
This commit is contained in:
parent
60b3bbdea4
commit
d098b62975
|
@ -128,14 +128,14 @@ std::string ErrorLogger::ErrorMessage::toText() const
|
|||
return text.str();
|
||||
}
|
||||
|
||||
void ErrorLogger::_writemsg(const Tokenizer *tokenizer, const Token *tok, const char severity[], const std::string msg, const std::string &id)
|
||||
void ErrorLogger::_writemsg(const Tokenizer *tokenizer, const Token *tok, const char severity[], const std::string &msg, const std::string &id)
|
||||
{
|
||||
std::list<const Token *> callstack;
|
||||
callstack.push_back(tok);
|
||||
_writemsg(tokenizer, callstack, severity, msg, id);
|
||||
}
|
||||
|
||||
void ErrorLogger::_writemsg(const Tokenizer *tokenizer, const std::list<const Token *> &callstack, const char severity[], const std::string msg, const std::string &id)
|
||||
void ErrorLogger::_writemsg(const Tokenizer *tokenizer, const std::list<const Token *> &callstack, const char severity[], const std::string &msg, const std::string &id)
|
||||
{
|
||||
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
|
||||
for (std::list<const Token *>::const_iterator tok = callstack.begin(); tok != callstack.end(); ++tok)
|
||||
|
@ -150,7 +150,7 @@ void ErrorLogger::_writemsg(const Tokenizer *tokenizer, const std::list<const To
|
|||
}
|
||||
|
||||
|
||||
void ErrorLogger::_writemsg(const std::string msg, const std::string &id)
|
||||
void ErrorLogger::_writemsg(const std::string &msg, const std::string &id)
|
||||
{
|
||||
std::ostringstream xml;
|
||||
xml << "<error";
|
||||
|
|
|
@ -491,8 +491,8 @@ public:
|
|||
static std::string callStackToString(const std::list<ErrorLogger::ErrorMessage::FileLocation> &callStack);
|
||||
|
||||
private:
|
||||
void _writemsg(const Tokenizer *tokenizer, const Token *tok, const char severity[], const std::string msg, const std::string &id);
|
||||
void _writemsg(const Tokenizer *tokenizer, const std::list<const Token *> &callstack, const char severity[], const std::string msg, const std::string &id);
|
||||
void _writemsg(const std::string msg, const std::string &id);
|
||||
void _writemsg(const Tokenizer *tokenizer, const Token *tok, const char severity[], const std::string &msg, const std::string &id);
|
||||
void _writemsg(const Tokenizer *tokenizer, const std::list<const Token *> &callstack, const char severity[], const std::string &msg, const std::string &id);
|
||||
void _writemsg(const std::string &msg, const std::string &id);
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -225,9 +225,9 @@ int main()
|
|||
fout << " static std::string callStackToString(const std::list<ErrorLogger::ErrorMessage::FileLocation> &callStack);\n";
|
||||
fout << "\n";
|
||||
fout << "private:\n";
|
||||
fout << " void _writemsg(const Tokenizer *tokenizer, const Token *tok, const char severity[], const std::string msg, const std::string &id);\n";
|
||||
fout << " void _writemsg(const Tokenizer *tokenizer, const std::list<const Token *> &callstack, const char severity[], const std::string msg, const std::string &id);\n";
|
||||
fout << " void _writemsg(const std::string msg, const std::string &id);\n";
|
||||
fout << " void _writemsg(const Tokenizer *tokenizer, const Token *tok, const char severity[], const std::string &msg, const std::string &id);\n";
|
||||
fout << " void _writemsg(const Tokenizer *tokenizer, const std::list<const Token *> &callstack, const char severity[], const std::string &msg, const std::string &id);\n";
|
||||
fout << " void _writemsg(const std::string &msg, const std::string &id);\n";
|
||||
fout << "};\n";
|
||||
fout << "#endif\n";
|
||||
std::cout << std::endl;
|
||||
|
|
Loading…
Reference in New Issue