Skip to content

Commit

Permalink
Make further use of getVariableTokenAfterAttributes() helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mptre committed Aug 6, 2024
1 parent a0b583d commit d690b9b
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9257,22 +9257,7 @@ void Tokenizer::simplifyAttribute()
}

else if (Token::Match(attr, "[(,] unused|__unused__|used|__used__ [,)]")) {
Token *vartok = nullptr;
Token *after = getTokenAfterAttributes(tok, true);

// check if after variable name
if (Token::Match(after, ";|=")) {
Token *prev = tok->previous();
while (Token::simpleMatch(prev, "]"))
prev = prev->link()->previous();
if (Token::Match(prev, "%type%"))
vartok = prev;
}

// check if before variable name
else if (Token::Match(after, "%type%"))
vartok = after;

Token *vartok = getVariableTokenAfterAttributes(tok);
if (vartok) {
const std::string &attribute(attr->strAt(1));
if (attribute.find("unused") != std::string::npos)
Expand Down

0 comments on commit d690b9b

Please sign in to comment.