C++: Remove exception from cpp/unused-local-variable that is no longer needed

This commit is contained in:
Jeroen Ketema
2022-03-24 23:45:29 +01:00
parent 3fed59fd13
commit 4f49f9d6e1

View File

@@ -58,11 +58,5 @@ where
not exists(AsmStmt s | f = s.getEnclosingFunction()) and
not v.getAnAttribute().getName() = "unused" and
not any(ErrorExpr e).getEnclosingFunction() = f and // unextracted expr may use `v`
not exists(
Literal l // this case can be removed when the `myFunction2( [obj](){} );` test case doesn't depend on this exclusion
|
l.getEnclosingFunction() = f and
not exists(l.getValue())
) and
not any(ConditionDeclExpr cde).getEnclosingFunction() = f // this case can be removed when the `if (a = b; a)` test case doesn't depend on this exclusion
select v, "Variable " + v.getName() + " is not used"