Adjust cppcheck AST debug output a little bit. Write location for each AST tree
This commit is contained in:
parent
b87aaaac52
commit
40156365b8
|
@ -1518,12 +1518,13 @@ static void astStringXml(const Token *tok, nonneg int indent, std::ostream &out)
|
||||||
|
|
||||||
void Token::printAst(bool verbose, bool xml, std::ostream &out) const
|
void Token::printAst(bool verbose, bool xml, std::ostream &out) const
|
||||||
{
|
{
|
||||||
|
if (!xml)
|
||||||
|
out << "\n\n##AST" << std::endl;
|
||||||
|
|
||||||
std::set<const Token *> printed;
|
std::set<const Token *> printed;
|
||||||
for (const Token *tok = this; tok; tok = tok->next()) {
|
for (const Token *tok = this; tok; tok = tok->next()) {
|
||||||
if (!tok->mImpl->mAstParent && tok->mImpl->mAstOperand1) {
|
if (!tok->mImpl->mAstParent && tok->mImpl->mAstOperand1) {
|
||||||
if (printed.empty() && !xml)
|
if (printed.find(tok) != printed.end())
|
||||||
out << "\n\n##AST" << std::endl;
|
|
||||||
else if (printed.find(tok) != printed.end())
|
|
||||||
continue;
|
continue;
|
||||||
printed.insert(tok);
|
printed.insert(tok);
|
||||||
|
|
||||||
|
@ -1533,7 +1534,7 @@ void Token::printAst(bool verbose, bool xml, std::ostream &out) const
|
||||||
astStringXml(tok, 2U, out);
|
astStringXml(tok, 2U, out);
|
||||||
out << "</ast>" << std::endl;
|
out << "</ast>" << std::endl;
|
||||||
} else if (verbose)
|
} else if (verbose)
|
||||||
out << tok->astStringVerbose() << std::endl;
|
out << "fileIndex " << tok->fileIndex() << " line " << tok->linenr() << std::endl << tok->astStringVerbose() << std::endl;
|
||||||
else
|
else
|
||||||
out << tok->astString(" ") << std::endl;
|
out << tok->astString(" ") << std::endl;
|
||||||
if (tok->str() == "(")
|
if (tok->str() == "(")
|
||||||
|
|
Loading…
Reference in New Issue