C++: Work around issue with 'Unknown literal'.

This commit is contained in:
Geoffrey White
2020-11-02 10:39:06 +00:00
parent 35f4646ee0
commit 79bda0055c
2 changed files with 5 additions and 2 deletions

View File

@@ -57,5 +57,9 @@ where
not declarationHasSideEffects(v) and
not exists(AsmStmt s | f = s.getEnclosingFunction()) and
not v.getAnAttribute().getName() = "unused" and
not any(ErrorExpr e).getEnclosingFunction() = f // unextracted expr likely used `v`
not any(ErrorExpr e).getEnclosingFunction() = f and // unextracted expr may use `v`
not exists(Literal l |
l.getEnclosingFunction() = f and
not exists(l.getValue())
)
select v, "Variable " + v.getName() + " is not used"