From fbf2ef862584c23015f64b9ab7da45b7682c28ea Mon Sep 17 00:00:00 2001 From: Jonas Jensen Date: Tue, 19 Nov 2019 13:20:21 +0100 Subject: [PATCH] C++: Don't check if a Field is static A `Field` in the C++ QL libraries can't be static, but I'd for some reason written two checks for `Field`s being static in the data-flow library. --- .../src/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll | 1 - cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll index 7da10f030d6..ab95d38ed0f 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll @@ -219,7 +219,6 @@ predicate storeStep(Node node1, Content f, PostUpdateNode node2) { node1.asExpr() = a and a.getLValue() = fa ) and - not fa.getTarget().isStatic() and node2.getPreUpdateNode().asExpr() = fa.getQualifier() and f.(FieldContent).getField() = fa.getTarget() ) diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll index 2ed106a4940..abd56c6283c 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll @@ -133,8 +133,7 @@ private module PartialDefinitions { TReferenceArgument(Expr arg, VariableAccess va) { referenceArgument(va, arg) } private predicate isInstanceFieldWrite(FieldAccess fa, ControlFlowNode node) { - not fa.getTarget().isStatic() and - assignmentLikeOperation(node, fa.getTarget(), fa, _) + assignmentLikeOperation(node, _, fa, _) } class PartialDefinition extends TPartialDefinition {