Skip to content

Commit

Permalink
add check for missing closing brace + remove redundant check
Browse files Browse the repository at this point in the history
  • Loading branch information
ludviggunne committed Sep 12, 2024
1 parent 7cf50ca commit 5ba0d44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/checkunusedvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ void CheckUnusedVar::checkStructMemberUsage()
// Check if the struct member variable is used anywhere in the file
bool use = false;
for (const Token *tok = mTokenizer->tokens(); tok; tok = tok->next()) {
if (Token::Match(tok, "%name% {") && (!tok->previous() || !Token::Match(tok->previous(), "class|struct")) && tok->str() == scope.className) {
if (Token::Match(tok, "%name% {") && !Token::Match(tok->previous(), "class|struct") && tok->str() == scope.className && tok->linkAt(1)) {
const Token *inner = tok->next()->astOperand2();
// Find number of initialized members in braced initalizer
int initmembs = 0;
Expand Down

0 comments on commit 5ba0d44

Please sign in to comment.