dump: Add platform info and valueType info

This commit is contained in:
Daniel Marjamäki 2017-04-15 12:25:44 +02:00
parent 1b1099201c
commit e71b428740
2 changed files with 16 additions and 0 deletions

View File

@ -143,6 +143,15 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin
if (fdump.is_open()) { if (fdump.is_open()) {
fdump << "<?xml version=\"1.0\"?>" << std::endl; fdump << "<?xml version=\"1.0\"?>" << std::endl;
fdump << "<dumps>" << std::endl; fdump << "<dumps>" << std::endl;
fdump << " <platform"
<< " name=\"" << _settings.platformString() << '\"'
<< " char bit=\"" << _settings.char_bit << '\"'
<< " short_bit=\"" << _settings.short_bit << '\"'
<< " int_bit=\"" << _settings.int_bit << '\"'
<< " long_bit=\"" << _settings.long_bit << '\"'
<< " long_long_bit=\"" << _settings.long_long_bit << '\"'
<< " pointer_bit=\"" << (_settings.sizeof_pointer * _settings.char_bit) << '\"'
<< "/>\n";
fdump << " <rawtokens>" << std::endl; fdump << " <rawtokens>" << std::endl;
for (unsigned int i = 0; i < files.size(); ++i) for (unsigned int i = 0; i < files.size(); ++i)
fdump << " <file index=\"" << i << "\" name=\"" << ErrorLogger::toxml(files[i]) << "\"/>" << std::endl; fdump << " <file index=\"" << i << "\" name=\"" << ErrorLogger::toxml(files[i]) << "\"/>" << std::endl;

View File

@ -3919,6 +3919,13 @@ void Tokenizer::dump(std::ostream &out) const
out << " astOperand1=\"" << tok->astOperand1() << '\"'; out << " astOperand1=\"" << tok->astOperand1() << '\"';
if (tok->astOperand2()) if (tok->astOperand2())
out << " astOperand2=\"" << tok->astOperand2() << '\"'; out << " astOperand2=\"" << tok->astOperand2() << '\"';
if (tok->valueType()) {
std::string s = tok->valueType()->str();
std::string::size_type pos = s.find("container(");
if (pos != std::string::npos)
s.erase(pos+9, s.find(")",pos)-pos-8);
out << " valueType=\"" << s << '\"';
}
out << "/>" << std::endl; out << "/>" << std::endl;
} }
out << " </tokenlist>" << std::endl; out << " </tokenlist>" << std::endl;