Add col and info in plist

This commit is contained in:
Daniel Marjamäki 2017-05-17 15:22:51 +02:00
parent 6230919976
commit 90a952d8c2
2 changed files with 15 additions and 15 deletions

View File

@ -480,13 +480,13 @@ std::string ErrorLogger::callStackToString(const std::list<ErrorLogger::ErrorMes
}
ErrorLogger::ErrorMessage::FileLocation::FileLocation(const Token* tok, const TokenList* list)
: line(tok->linenr()), fileNumber(tok->fileIndex()), _file(list->file(tok))
ErrorLogger::ErrorMessage::FileLocation::FileLocation(const Token* tok, const TokenList* tokenList)
: fileIndex(tok->fileIndex()), line(tok->linenr()), col(tok->col()), _file(tokenList->file(tok))
{
}
ErrorLogger::ErrorMessage::FileLocation::FileLocation(const Token* tok, const std::string &info, const TokenList* list)
: line(tok->linenr()), fileNumber(tok->fileIndex()), _file(list->file(tok)), _info(info)
ErrorLogger::ErrorMessage::FileLocation::FileLocation(const Token* tok, const std::string &info, const TokenList* tokenList)
: fileIndex(tok->fileIndex()), line(tok->linenr()), col(tok->col()), _file(tokenList->file(tok)), _info(info)
{
}
@ -571,8 +571,8 @@ static std::string plistLoc(const char indent[], const ErrorLogger::ErrorMessage
std::ostringstream ostr;
ostr << indent << "<dict>\r\n"
<< indent << ' ' << "<key>line</key><integer>" << loc.line << "</integer>\r\n"
<< indent << ' ' << "<key>col</key><integer>1</integer>\r\n"
<< indent << ' ' << "<key>file</key><integer>" << loc.fileNumber << "</integer>\r\n"
<< indent << ' ' << "<key>col</key><integer>" << loc.col << "</integer>\r\n"
<< indent << ' ' << "<key>file</key><integer>" << loc.fileIndex << "</integer>\r\n"
<< indent << "</dict>\r\n";
return ostr.str();
}
@ -611,8 +611,7 @@ std::string ErrorLogger::plistData(const ErrorLogger::ErrorMessage &msg)
std::list<ErrorLogger::ErrorMessage::FileLocation>::const_iterator next = it;
++next;
const std::string shortMessage = (next == msg._callStack.end() ? msg.shortMessage() : std::string());
const std::string verboseMessage = (next == msg._callStack.end() ? msg.verboseMessage() : std::string());
const std::string message = (it->getinfo().empty() && next == msg._callStack.end() ? msg.shortMessage() : it->getinfo());
plist << " <dict>\r\n"
<< " <key>kind</key><string>event</string>\r\n"
@ -627,9 +626,9 @@ std::string ErrorLogger::plistData(const ErrorLogger::ErrorMessage &msg)
<< " </array>\r\n"
<< " <key>depth</key><integer>0</integer>\r\n"
<< " <key>extended_message</key>\r\n"
<< " <string>" << ErrorLogger::toxml(verboseMessage) << "</string>\r\n"
<< " <string>" << ErrorLogger::toxml(message) << "</string>\r\n"
<< " <key>message</key>\r"
<< " <string>" << ErrorLogger::toxml(shortMessage) << "</string>\r\n"
<< " <string>" << ErrorLogger::toxml(message) << "</string>\r\n"
<< " </dict>\r\n";
}

View File

@ -186,18 +186,18 @@ public:
class CPPCHECKLIB FileLocation {
public:
FileLocation()
: line(0), fileNumber(0) {
: fileIndex(0), line(0), col(0) {
}
FileLocation(const std::string &file, unsigned int aline)
: line(aline), fileNumber(0), _file(file) {
: fileIndex(0), line(aline), col(0), _file(file) {
}
FileLocation(const std::string &file, const std::string &info, unsigned int aline)
: line(aline), fileNumber(0), _file(file), _info(info) {
: fileIndex(0), line(aline), col(0), _file(file), _info(info) {
}
FileLocation(const Token* tok, const TokenList* list);
FileLocation(const Token* tok, const TokenList* tokenList);
FileLocation(const Token* tok, const std::string &info, const TokenList* tokenList);
/**
@ -218,8 +218,9 @@ public:
*/
std::string stringify() const;
unsigned int fileIndex;
unsigned int line;
unsigned int fileNumber;
unsigned int col;
std::string getinfo() const {
return _info;