Skip to content

Commit 0f295c6

Browse files
committed
CPP: Add QLDoc to the PartialDefinitions class.
1 parent d092905 commit 0f295c6

File tree

1 file changed

+18
-2
lines changed
  • cpp/ql/src/semmle/code/cpp/dataflow/internal

1 file changed

+18
-2
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,13 @@ cached class FlowVar extends TFlowVar {
8484
*
8585
* In contrast to a normal "definition", which provides a new value for
8686
* something, a partial definition is an expression that may affect a
87-
* value, but does not necessarily replace it entirely. For example,
88-
* `x.y = 1;` is a partial definition of the object `x`.
87+
* value, but does not necessarily replace it entirely. For example:
88+
* ```
89+
* x.y = 1; // a partial definition of the object `x`.
90+
* x.y.z = 1; // a partial definition of the objects `x` and `x.y`.
91+
* x.setY(1); // a partial definition of the object `x`.
92+
* setY(&x); // a partial definition of the object `x`.
93+
* ```
8994
*/
9095
private module PartialDefinitions {
9196
private newtype TPartialDefinition =
@@ -121,8 +126,19 @@ private module PartialDefinitions {
121126

122127
predicate partiallyDefinesThis(ThisExpr e) { definedExpr = e }
123128

129+
/**
130+
* Gets the subBasicBlock where this `PartialDefinition` is defined.
131+
*/
124132
ControlFlowNode getSubBasicBlockStart() { result = node }
125133

134+
/**
135+
* Gets the expression that is being partially defined. For example in the
136+
* following code:
137+
* ```
138+
* x.y = 1;
139+
* ```
140+
* The expression `x` is being partially defined.
141+
*/
126142
Expr getDefinedExpr() { result = definedExpr }
127143

128144
Location getLocation() {

0 commit comments

Comments
 (0)