MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / dump

Method dump

lib/tokenize.cpp:6111–6379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6109}
6110
6111void Tokenizer::dump(std::ostream &out) const
6112{
6113 // Create a xml data dump.
6114 // The idea is not that this will be readable for humans. It's a
6115 // data dump that 3rd party tools could load and get useful info from.
6116
6117 std::string outs;
6118
6119 std::set<const Library::Container*> containers;
6120
6121 outs += " <directivelist>";
6122 outs += '\n';
6123 for (const Directive &dir : mDirectives) {
6124 outs += " <directive ";
6125 outs += "file=\"";
6126 outs += ErrorLogger::toxml(Path::getRelativePath(dir.file, mSettings.basePaths));
6127 outs += "\" ";
6128 outs += "linenr=\"";
6129 outs += std::to_string(dir.linenr);
6130 outs += "\" ";
6131 // str might contain characters such as '"', '<' or '>' which
6132 // could result in invalid XML, so run it through toxml().
6133 outs += "str=\"";
6134 outs += ErrorLogger::toxml(dir.str);
6135 outs +="\">";
6136 outs += '\n';
6137 for (const auto & strToken : dir.strTokens) {
6138 outs += " <token ";
6139 outs += "column=\"";
6140 outs += std::to_string(strToken.column);
6141 outs += "\" ";
6142 outs += "str=\"";
6143 outs += ErrorLogger::toxml(strToken.tokStr);
6144 outs +="\"/>";
6145 outs += '\n';
6146 }
6147 outs += " </directive>";
6148 outs += '\n';
6149 }
6150 outs += " </directivelist>";
6151 outs += '\n';
6152
6153 // tokens..
6154 outs += " <tokenlist>";
6155 outs += '\n';
6156 for (const Token *tok = list.front(); tok; tok = tok->next()) {
6157 outs += " <token id=\"";
6158 outs += id_string(tok);
6159 outs += "\" file=\"";
6160 outs += ErrorLogger::toxml(list.file(tok));
6161 outs += "\" linenr=\"";
6162 outs += std::to_string(tok->linenr());
6163 outs += "\" column=\"";
6164 outs += std::to_string(tok->column());
6165 outs += "\"";
6166
6167 outs += " str=\"";
6168 outs += ErrorLogger::toxml(tok->str());

Callers 7

checkClangMethod · 0.45
calculateHashMethod · 0.45
checkInternalMethod · 0.45
writeCheckersReportMethod · 0.45
directiveDumpMethod · 0.45
dumpAlignasMethod · 0.45
dumpFallthroughMethod · 0.45

Calls 15

id_stringFunction · 0.85
isFloatFunction · 0.85
bool_to_stringFunction · 0.85
frontMethod · 0.80
nextMethod · 0.80
columnMethod · 0.80
scopeMethod · 0.80
isUnsignedMethod · 0.80
isOpMethod · 0.80
isArithmeticalOpMethod · 0.80
isAssignmentOpMethod · 0.80
isCastMethod · 0.80

Tested by 3

directiveDumpMethod · 0.36
dumpAlignasMethod · 0.36
dumpFallthroughMethod · 0.36