QL: exclude fields that are uniquely used in call to an IPA constructor

This commit is contained in:
Erik Krogh Kristensen
2022-01-20 11:37:08 +01:00
parent 6e9771fbf6
commit 6b7d84add7

View File

@@ -16,5 +16,10 @@ where
forex(FieldAccess access | access.getDeclaration() = f |
access.getEnclosingPredicate() = c.getCharPred()
) and
// excluding fields that are uniquely used in call to an IPA constructor
not unique(FieldAccess access | access.getDeclaration() = f | access) =
any(PredicateCall call |
call.getEnclosingPredicate() = c.getCharPred() and call.getTarget() instanceof NewTypeBranch
).getAnArgument() and
not f.getVarDecl().overrides(_)
select f, "Field is only used in CharPred"