Skip to content

Commit afb9e43

Browse files
committed
dump: write container information
1 parent e59e34c commit afb9e43

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

lib/symboldatabase.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7361,6 +7361,7 @@ std::string ValueType::dump() const
73617361
break;
73627362
case CONTAINER:
73637363
ret << "valueType-type=\"container\"";
7364+
ret << " valueType-containerId=\"" << container << "\"";
73647365
break;
73657366
case ITERATOR:
73667367
ret << "valueType-type=\"iterator\"";

lib/tokenize.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5725,6 +5725,8 @@ void Tokenizer::dump(std::ostream &out) const
57255725
// The idea is not that this will be readable for humans. It's a
57265726
// data dump that 3rd party tools could load and get useful info from.
57275727

5728+
std::set<const Library::Container*> containers;
5729+
57285730
// tokens..
57295731
out << " <tokenlist>" << std::endl;
57305732
for (const Token *tok = list.front(); tok; tok = tok->next()) {
@@ -5804,6 +5806,7 @@ void Tokenizer::dump(std::ostream &out) const
58045806
const std::string vt = tok->valueType()->dump();
58055807
if (!vt.empty())
58065808
out << ' ' << vt;
5809+
containers.insert(tok->valueType()->container);
58075810
}
58085811
if (!tok->varId() && tok->scope()->isExecutable() && Token::Match(tok, "%name% (")) {
58095812
if (mSettings->library.isnoreturn(tok))
@@ -5815,6 +5818,18 @@ void Tokenizer::dump(std::ostream &out) const
58155818
out << " </tokenlist>" << std::endl;
58165819

58175820
mSymbolDatabase->printXml(out);
5821+
5822+
containers.erase(nullptr);
5823+
if (!containers.empty()) {
5824+
out << " <containers>\n";
5825+
for (const Library::Container* c: containers) {
5826+
out << " <container id=\"" << c << "\" array-like-index-op=\""
5827+
<< (c->arrayLike_indexOp ? "true" : "false") << "\" "
5828+
<< "std-string-like=\"" << (c->stdStringLike ? "true" : "false") << "\"/>\n";
5829+
}
5830+
out << " </containers>\n";
5831+
}
5832+
58185833
if (list.front())
58195834
list.front()->printValueFlow(true, out);
58205835

0 commit comments

Comments
 (0)