Skip to content

Commit

Permalink
Update symboldatabase.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Aug 21, 2024
1 parent 7e59486 commit e05fba1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
return endInitList.top().second == scope;
};

bool inIfCondition = false;
std::stack<const Token*> inIfCondition;

auto addLambda = [this, &scope](const Token* tok, const Token* lambdaEndToken) -> const Token* {
const Token* lambdaStartToken = lambdaEndToken->link();
Expand Down Expand Up @@ -735,7 +735,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
else if (scope->type == Scope::eCatch)
scope->checkVariable(tok->tokAt(2), AccessControl::Throw, mSettings); // check for variable declaration and add it to new scope if found
tok = tok->next();
inIfCondition = true;
inIfCondition.push(tok->link()->next());
} else if (Token::Match(tok, "%var% {")) {
endInitList.emplace(tok->linkAt(1), scope);
tok = tok->next();
Expand All @@ -744,8 +744,8 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
} else if (tok->str() == "{") {
if (inInitList()) {
endInitList.emplace(tok->link(), scope);
} else if (inIfCondition) {
inIfCondition = false;
} else if (!inIfCondition.empty() && tok == inIfCondition.top()) {
inIfCondition.pop();
} else if (isExecutableScope(tok)) {
scopeList.emplace_back(this, tok, scope, Scope::eUnconditional, tok);
scope->nestedList.push_back(&scopeList.back());
Expand Down

0 comments on commit e05fba1

Please sign in to comment.