Skip to content

Commit 573763a

Browse files
committed
Shared: More revisions, manual and aided by further discussion with Copilot.
1 parent 7b85bb4 commit 573763a

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

shared/dataflow/codeql/dataflow/DataFlow.qll

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/** Provides language-specific data flow parameters. */
88
signature module InputSig {
99
/**
10-
* Represents a node in the data flow graph.
10+
* A node in the data flow graph.
1111
*/
1212
class Node {
1313
/** Gets a textual representation of this element. */
@@ -34,16 +34,23 @@ signature module InputSig {
3434
}
3535

3636
/**
37-
* Represents a node in the data flow graph that represents an output.
37+
* A node in the data flow graph that represents an output.
3838
*/
3939
class OutNode extends Node;
4040

4141
/**
42-
* Represents a node in the data flow graph that corresponds to a post-update operation.
42+
* A node in the data flow graph representing the value of an argument after
43+
* a function call returns. For example, consider the following C++ code:
44+
* ```
45+
* int a = 1;
46+
* increment(&a);
47+
* ```
48+
* The post-update node for `&a` represents the value of `&a` after
49+
* modification by the call to `increment`.
4350
*/
4451
class PostUpdateNode extends Node {
4552
/**
46-
* Gets the node that represents the pre-update operation.
53+
* Gets the node that represents the same value prior to the operation.
4754
*
4855
* @return The pre-update node.
4956
*/
@@ -170,7 +177,7 @@ signature module InputSig {
170177
}
171178

172179
/**
173-
* Represents a content approximation.
180+
* A content approximation.
174181
*/
175182
class ContentApprox {
176183
/** Gets a textual representation of this element. */

shared/rangeanalysis/codeql/rangeanalysis/RangeAnalysis.qll

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ signature module Semantic {
161161
default string getBlockId2(BasicBlock bb) { result = "" }
162162

163163
/**
164-
* Represents a guard in the range analysis.
164+
* A guard in the range analysis.
165165
*/
166166
class Guard {
167167
/**
@@ -180,7 +180,15 @@ signature module Semantic {
180180
Expr asExpr();
181181

182182
/**
183-
* Holds if the guard directly controls a given basic block.
183+
* Holds if the guard directly controls a given basic block. For example in
184+
* the following code, the guard `(x > y)` directly controls the block
185+
* beneath it:
186+
* ```
187+
* if (x > y)
188+
* {
189+
* Console.WriteLine("x is greater than y");
190+
* }
191+
* ```
184192
*
185193
* @param controlled The basic block to check.
186194
*/
@@ -194,7 +202,17 @@ signature module Semantic {
194202
predicate isEquality(Expr e1, Expr e2, boolean polarity);
195203

196204
/**
197-
* Holds if there is a branch edge between two basic blocks.
205+
* Holds if there is a branch edge between two basic blocks. For example
206+
* in the following C code, there are two branch edges from the basic block
207+
* containing the condition `(x > y)` to the beginnings of the true and
208+
* false blocks that follow:
209+
* ```
210+
* if (x > y) {
211+
* printf("x is greater than y\n");
212+
* } else {
213+
* printf("x is not greater than y\n");
214+
* }
215+
* ```
198216
*
199217
* @param bb1 The first basic block.
200218
*/
@@ -222,7 +240,7 @@ signature module Semantic {
222240
Type getExprType(Expr e);
223241

224242
/**
225-
* Represents a single static single assignment (SSA) variable.
243+
* A single static single assignment (SSA) variable.
226244
*/
227245
class SsaVariable {
228246
/**
@@ -237,15 +255,17 @@ signature module Semantic {
237255
}
238256

239257
/**
240-
* Represents a phi node in the SSA form.
258+
* A phi node in the SSA form. A phi node is a kind of node in the SSA form
259+
* that represents a merge point where multiple control flow paths converge
260+
* and the value of a variable needs to be selected.
241261
*/
242262
class SsaPhiNode extends SsaVariable {
243263
/** Holds if `inp` is an input to the phi node along the edge originating in `bb`. */
244264
predicate hasInputFromBlock(SsaVariable inp, BasicBlock bb);
245265
}
246266

247267
/**
248-
* Represents a single update to a variable in the SSA form.
268+
* A single update to a variable in the SSA form.
249269
*/
250270
class SsaExplicitUpdate extends SsaVariable {
251271
/**
@@ -344,7 +364,8 @@ signature module LangSig<Semantic Sem, DeltaSig D> {
344364

345365
signature module BoundSig<LocationSig Location, Semantic Sem, DeltaSig D> {
346366
/**
347-
* Represents a semantic bound.
367+
* A semantic bound, which defines a constraint on the possible values of an
368+
* expression.
348369
*/
349370
class SemBound {
350371
/**

0 commit comments

Comments
 (0)