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 426c621 commit c1ab08a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
return endInitList.top().second == scope;
};

bool inIfCondition = false;

auto addLambda = [this, &scope](const Token* tok, const Token* lambdaEndToken) -> const Token* {
const Token* lambdaStartToken = lambdaEndToken->link();
const Token* argStart = lambdaStartToken->astParent();
Expand Down Expand Up @@ -732,7 +734,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
scope->checkVariable(tok->tokAt(2), AccessControl::Local, mSettings); // check for variable declaration and add it to new scope if found
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 = scopeStartTok;
tok = tok->next();
} else if (Token::Match(tok, "%var% {")) {
endInitList.emplace(tok->linkAt(1), scope);
tok = tok->next();
Expand All @@ -741,6 +743,8 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
} else if (tok->str() == "{") {
if (inInitList()) {
endInitList.emplace(tok->link(), scope);
} else if (inIfCondition) {
inIfCondition = false;
} 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 c1ab08a

Please sign in to comment.