Skip to content

Commit 9bd7a8f

Browse files
committed
always print verbose AST with --debug-ast [skip ci]
1 parent 169bc78 commit 9bd7a8f

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

lib/token.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ static void astStringXml(const Token *tok, nonneg int indent, std::ostream &out)
16551655
}
16561656
}
16571657

1658-
void Token::printAst(bool verbose, bool xml, const std::vector<std::string> &fileNames, std::ostream &out) const
1658+
void Token::printAst(bool xml, const std::vector<std::string> &fileNames, std::ostream &out) const
16591659
{
16601660
if (!xml)
16611661
out << "\n\n##AST" << std::endl;
@@ -1672,10 +1672,8 @@ void Token::printAst(bool verbose, bool xml, const std::vector<std::string> &fil
16721672
<< "\" column=\"" << tok->column() << "\">" << std::endl;
16731673
astStringXml(tok, 2U, out);
16741674
out << "</ast>" << std::endl;
1675-
} else if (verbose)
1675+
} else
16761676
out << "[" << fileNames[tok->fileIndex()] << ":" << tok->linenr() << "]" << std::endl << tok->astStringVerbose() << std::endl;
1677-
else
1678-
out << tok->astString(" ") << std::endl;
16791677
if (tok->str() == "(")
16801678
tok = tok->link();
16811679
}

lib/token.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ class CPPCHECKLIB Token {
15591559

15601560
std::string expressionString() const;
15611561

1562-
void printAst(bool verbose, bool xml, const std::vector<std::string> &fileNames, std::ostream &out) const;
1562+
void printAst(bool xml, const std::vector<std::string> &fileNames, std::ostream &out) const;
15631563

15641564
void printValueFlow(const std::vector<std::string>& files, bool xml, std::ostream &out) const;
15651565

lib/tokenize.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5962,9 +5962,8 @@ void Tokenizer::printDebugOutput(std::ostream &out) const
59625962
mSymbolDatabase->printOut("Symbol database");
59635963
}
59645964

5965-
// TODO: do not depend on --verbose
59665965
if (mSettings.debugast)
5967-
list.front()->printAst(mSettings.verbose, xml, list.getFiles(), out);
5966+
list.front()->printAst(xml, list.getFiles(), out);
59685967

59695968
if (mSettings.debugnormal || mSettings.debugvalueflow)
59705969
list.front()->printValueFlow(list.getFiles(), xml, out);

test/cli/other_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3467,7 +3467,6 @@ def test_debug_ast(tmp_path):
34673467
__test_debug_ast(tmp_path, False)
34683468

34693469

3470-
@pytest.mark.xfail(strict=True) # TODO: remove dependency on --verbose
34713470
def test_debug_ast_verbose_nodiff(tmp_path):
34723471
# make sure --verbose does not change the output
34733472
assert __test_debug_ast(tmp_path, False) == __test_debug_ast(tmp_path, True)

0 commit comments

Comments
 (0)