From d96ac7cc3a748f363d426435d7396107701ab782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Sun, 5 Jan 2025 15:57:05 +0100 Subject: [PATCH] simplify --- lib/checkunusedvar.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/checkunusedvar.cpp b/lib/checkunusedvar.cpp index 3a38fe28e3c..c2de16ddc77 100644 --- a/lib/checkunusedvar.cpp +++ b/lib/checkunusedvar.cpp @@ -1536,14 +1536,10 @@ void CheckUnusedVar::checkStructMemberUsage() // Bailout if struct is used in structured binding for (const Variable *var : symbolDatabase->variableList()) { - if (!var || !Token::simpleMatch(var->typeStartToken(), "auto")) + if (!var || !Token::Match(var->typeStartToken(), "auto &|&&| [ %varid%", var->declarationId())) continue; - const Token *tok = var->nameToken()->previous(); - if (!Token::simpleMatch(tok, "[")) - continue; - - tok = tok->link(); + const Token *tok = var->nameToken()->linkAt(-1); if (!Token::Match(tok, "] %assign%")) continue;