File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
src/Best Practices/Unused Entities
test/query-tests/Best Practices/Unused Entities/UnusedLocals Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 5757 not declarationHasSideEffects ( v ) and
5858 not exists ( AsmStmt s | f = s .getEnclosingFunction ( ) ) and
5959 not v .getAnAttribute ( ) .getName ( ) = "unused" and
60- not any ( ErrorExpr e ) .getEnclosingFunction ( ) = f // unextracted expr likely used `v`
60+ not any ( ErrorExpr e ) .getEnclosingFunction ( ) = f and // unextracted expr may use `v`
61+ not exists ( Literal l |
62+ l .getEnclosingFunction ( ) = f and
63+ not exists ( l .getValue ( ) )
64+ )
6165select v , "Variable " + v .getName ( ) + " is not used"
Original file line number Diff line number Diff line change 88| code2.cpp:108:11:108:12 | v2 | Variable v2 is not used |
99| code2.cpp:128:9:128:9 | b | Variable b is not used |
1010| code2.cpp:141:18:141:18 | b | Variable b is not used |
11- | code2.cpp:162:14:162:16 | obj | Variable obj is not used |
1211| code.c:10:18:10:18 | y | Variable y is not used |
1312| code.c:11:18:11:18 | z | Variable z is not used |
1413| code.c:18:7:18:7 | x | Variable x is not used |
You can’t perform that action at this time.
0 commit comments