Skip to content

Commit e51d809

Browse files
committed
TokenList: reduced dependency on settings
1 parent f69ab38 commit e51d809

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/tokenize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,10 +3361,10 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)
33613361
if (mTimerResults) {
33623362
Timer t("Tokenizer::simplifyTokens1::createAst", mSettings->showtime, mTimerResults);
33633363
list.createAst();
3364-
list.validateAst();
3364+
list.validateAst(mSettings->debugnormal);
33653365
} else {
33663366
list.createAst();
3367-
list.validateAst();
3367+
list.validateAst(mSettings->debugnormal);
33683368
}
33693369

33703370
if (mTimerResults) {

lib/tokenlist.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,10 +1722,10 @@ namespace {
17221722
};
17231723
}
17241724

1725-
void TokenList::validateAst() const
1725+
void TokenList::validateAst(bool print) const
17261726
{
17271727
OnException oe{[&] {
1728-
if (mSettings && mSettings->debugnormal)
1728+
if (print)
17291729
mTokensFrontBack.front->printOut();
17301730
}};
17311731
// Check for some known issues in AST to avoid crash/hang later on

lib/tokenlist.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class CPPCHECKLIB TokenList {
171171
* Check abstract syntax tree.
172172
* Throws InternalError on failure
173173
*/
174-
void validateAst() const;
174+
void validateAst(bool print) const;
175175

176176
/**
177177
* Verify that the given token is an element of the tokenlist.

test/testtokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5980,7 +5980,7 @@ class TestTokenizer : public TestFixture {
59805980
tokenList.prepareTernaryOpForAST();
59815981
tokenList.list.createAst();
59825982

5983-
tokenList.list.validateAst();
5983+
tokenList.list.validateAst(false);
59845984

59855985
// Basic AST validation
59865986
for (const Token *tok = tokenList.list.front(); tok; tok = tok->next()) {

0 commit comments

Comments
 (0)