Skip to content

Commit a8b4fb6

Browse files
committed
C++: Add qldoc (and remove predicate that wasn't needed).
1 parent 72a80e3 commit a8b4fb6

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private predicate instrToFieldNodeStoreStepNoChi(
241241
not exists(ChiInstruction chi | chi.getPartial() = store) and
242242
post.getPreUpdateNode() = getFieldNodeForFieldInstruction(store.getDestinationAddress()) and
243243
store.getSourceValueOperand() = node1.asOperand() and
244-
f.getADirectField() = post.getField()
244+
f.getADirectField() = post.getPreUpdateNode().getField()
245245
)
246246
}
247247

@@ -262,7 +262,7 @@ private predicate instrToFieldNodeStoreStepChi(
262262
chi.getPartialOperand() = operand and
263263
store = operand.getDef() and
264264
post.getPreUpdateNode() = getFieldNodeForFieldInstruction(store.getDestinationAddress()) and
265-
f.getADirectField() = post.getField()
265+
f.getADirectField() = post.getPreUpdateNode().getField()
266266
)
267267
}
268268

@@ -278,7 +278,7 @@ private predicate callableWithoutDefinitionStoreStep(
278278
post = node2.getPartialDefinition() and
279279
node1.asInstruction() = write and
280280
post.getPreUpdateNode() = getFieldNodeForFieldInstruction(write.getDestinationAddress()) and
281-
f.getADirectField() = post.getField() and
281+
f.getADirectField() = post.getPreUpdateNode().getField() and
282282
callable = write.getPrimaryInstruction().(CallInstruction).getStaticCallTarget() and
283283
not callable.hasDefinition()
284284
)

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ class PostUpdateFieldNode extends PartialDefinition {
283283
override Expr getDefinedExpr() {
284284
result = node.getFieldInstruction().getObjectAddress().getUnconvertedResultExpression()
285285
}
286-
287-
Field getField() { result = node.getField() }
288286
}
289287

290288
/**
@@ -450,10 +448,13 @@ abstract class PartialDefinition extends TPartialDefinition {
450448

451449
PartialDefinition() { this = MkPartialDefinition(node) }
452450

451+
/** Gets the node before the state update. */
453452
abstract Node getPreUpdateNode();
454453

454+
/** Gets the expression that is partially defined by this node. */
455455
abstract Expr getDefinedExpr();
456456

457+
/** Gets a string representation of this partial definition. */
457458
string toString() { result = node.toString() + " [partial definition]" }
458459
}
459460

@@ -480,6 +481,7 @@ class PartialDefinitionNode extends PostUpdateNode, TPartialDefinitionNode {
480481

481482
override Node getPreUpdateNode() { result = pd.getPreUpdateNode() }
482483

484+
/** Gets the `PartialDefinition` associated with this node. */
483485
PartialDefinition getPartialDefinition() { result = pd }
484486

485487
override string toString() { result = getPreUpdateNode().toString() + " [post update]" }

0 commit comments

Comments
 (0)