AST: Tweaked debug output

This commit is contained in:
Daniel Marjamäki 2020-10-31 18:57:48 +01:00
parent c25ae59fbe
commit 7804b28e70
3 changed files with 4 additions and 4 deletions

View File

@ -1516,7 +1516,7 @@ 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, const std::vector<std::string> &fileNames, std::ostream &out) const
{ {
if (!xml) if (!xml)
out << "\n\n##AST" << std::endl; out << "\n\n##AST" << std::endl;
@ -1534,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 << "fileIndex " << tok->fileIndex() << " line " << tok->linenr() << std::endl << tok->astStringVerbose() << std::endl; out << "[" << fileNames[tok->fileIndex()] << ":" << 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() == "(")

View File

@ -1340,7 +1340,7 @@ public:
std::string expressionString() const; std::string expressionString() const;
void printAst(bool verbose, bool xml, std::ostream &out) const; void printAst(bool verbose, bool xml, const std::vector<std::string> &fileNames, std::ostream &out) const;
void printValueFlow(bool xml, std::ostream &out) const; void printValueFlow(bool xml, std::ostream &out) const;

View File

@ -4903,7 +4903,7 @@ void Tokenizer::printDebugOutput(int simplification) const
} }
if (mSettings->verbose) if (mSettings->verbose)
list.front()->printAst(mSettings->verbose, mSettings->xml, std::cout); list.front()->printAst(mSettings->verbose, mSettings->xml, list.getFiles(), std::cout);
list.front()->printValueFlow(mSettings->xml, std::cout); list.front()->printValueFlow(mSettings->xml, std::cout);