Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f1d4b9

Browse files
committed
Shared: Generate some QLDoc using the "GitHub Copilot: Generate Docs" command.
1 parent e13d6cd commit 2f1d4b9

2 files changed

Lines changed: 128 additions & 19 deletions

File tree

shared/dataflow/codeql/dataflow/DataFlow.qll

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@
66

77
/** Provides language-specific data flow parameters. */
88
signature module InputSig {
9-
class Node {
10-
/** Gets a textual representation of this element. */
11-
string toString();
12-
13-
/**
14-
* Holds if this element is at the specified location.
15-
* The location spans column `startcolumn` of line `startline` to
16-
* column `endcolumn` of line `endline` in file `filepath`.
17-
* For more information, see
18-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
9+
/**
10+
* Represents a node in the data flow graph.
1911
*/
20-
predicate hasLocationInfo(
21-
string filepath, int startline, int startcolumn, int endline, int endcolumn
22-
);
23-
}
12+
class Node {
13+
/** Gets a textual representation of this element. */
14+
string toString();
15+
16+
/**
17+
* Holds if this element is at the specified location.
18+
* The location spans column `startcolumn` of line `startline` to
19+
* column `endcolumn` of line `endline` in file `filepath`.
20+
* For more information, see
21+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
22+
*/
23+
predicate hasLocationInfo(
24+
string filepath, int startline, int startcolumn, int endline, int endcolumn
25+
);
26+
}
2427

2528
class ParameterNode extends Node;
2629

@@ -30,9 +33,19 @@ signature module InputSig {
3033
ReturnKind getKind();
3134
}
3235

36+
/**
37+
* Represents a node in the data flow graph that represents an output.
38+
*/
3339
class OutNode extends Node;
3440

41+
/**
42+
* Represents a node in the data flow graph that corresponds to a post-update operation.
43+
*/
3544
class PostUpdateNode extends Node {
45+
/**
46+
* Retrieves the node that represents the pre-update operation.
47+
* @return The pre-update node.
48+
*/
3649
Node getPreUpdateNode();
3750
}
3851

@@ -131,6 +144,12 @@ signature module InputSig {
131144
string toString();
132145
}
133146

147+
/**
148+
* Predicate to force high precision for the given content.
149+
*
150+
* @param c The content to force high precision for.
151+
* @return True if high precision is forced for the content, false otherwise.
152+
*/
134153
predicate forceHighPrecision(Content c);
135154

136155
/**
@@ -150,10 +169,16 @@ signature module InputSig {
150169
Content getAReadContent();
151170
}
152171

153-
class ContentApprox {
154-
/** Gets a textual representation of this element. */
155-
string toString();
156-
}
172+
/**
173+
* Represents a content approximation.
174+
*/
175+
class ContentApprox {
176+
/**
177+
* Gets a textual representation of this element.
178+
* @return The textual representation of this element.
179+
*/
180+
string toString();
181+
}
157182

158183
ContentApprox getContentApprox(Content c);
159184

@@ -169,8 +194,22 @@ signature module InputSig {
169194
string toString();
170195
}
171196

197+
/**
198+
* Checks if the given parameter position matches the argument position.
199+
*
200+
* @param ppos The parameter position.
201+
* @param apos The argument position.
202+
* @return True if the parameter position matches the argument position, false otherwise.
203+
*/
172204
predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos);
173205

206+
/**
207+
* Represents a simple local flow step between two nodes.
208+
*
209+
* @param node1 The first node in the flow step.
210+
* @param node2 The second node in the flow step.
211+
* @return True if there is a simple local flow step between node1 and node2, false otherwise.
212+
*/
174213
predicate simpleLocalFlowStep(Node node1, Node node2);
175214

176215
/**

shared/rangeanalysis/codeql/rangeanalysis/RangeAnalysis.qll

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,49 @@ signature module Semantic {
160160
/** Gets a tiebreaker id in case `getBlockId1` is not unique. */
161161
default string getBlockId2(BasicBlock bb) { result = "" }
162162

163+
/**
164+
* Represents a guard in the range analysis.
165+
*/
163166
class Guard {
167+
/**
168+
* Returns a string representation of the guard.
169+
*/
164170
string toString();
165171

172+
/**
173+
* Returns the basic block associated with the guard.
174+
*/
166175
BasicBlock getBasicBlock();
167176

177+
/**
178+
* Returns the guard as an expression.
179+
*/
168180
Expr asExpr();
169181

182+
/**
183+
* Checks if the guard directly controls a given basic block.
184+
* @param controlled The basic block to check.
185+
* @param branch Indicates if the control is a branch or not.
186+
* @returns True if the guard directly controls the basic block, false otherwise.
187+
*/
170188
predicate directlyControls(BasicBlock controlled, boolean branch);
171189

190+
/**
191+
* Checks if the guard represents an equality between two expressions.
192+
* @param e1 The first expression.
193+
* @param e2 The second expression.
194+
* @param polarity The polarity of the equality.
195+
* @returns True if the guard represents the equality, false otherwise.
196+
*/
172197
predicate isEquality(Expr e1, Expr e2, boolean polarity);
173198

199+
/**
200+
* Checks if there is a branch edge between two basic blocks.
201+
* @param bb1 The first basic block.
202+
* @param bb2 The second basic block.
203+
* @param branch Indicates if the edge is a branch or not.
204+
* @returns True if there is a branch edge between the basic blocks, false otherwise.
205+
*/
174206
predicate hasBranchEdge(BasicBlock bb1, BasicBlock bb2, boolean branch);
175207
}
176208

@@ -194,18 +226,43 @@ signature module Semantic {
194226
/** Gets the type of an expression. */
195227
Type getExprType(Expr e);
196228

229+
/**
230+
* Represents a single static single assignment (SSA) variable.
231+
*/
197232
class SsaVariable {
233+
/**
234+
* Returns the expression where this SSA variable is used.
235+
*/
198236
Expr getAUse();
199237

238+
/**
239+
* Returns the basic block where this SSA variable is defined.
240+
*/
200241
BasicBlock getBasicBlock();
201242
}
202243

244+
/**
245+
* Represents a phi node in the SSA form.
246+
*/
203247
class SsaPhiNode extends SsaVariable {
204-
/** Holds if `inp` is an input to the phi node along the edge originating in `bb`. */
248+
/**
249+
* Holds if `inp` is an input to the phi node along the edge originating in `bb`.
250+
* @param inp The input variable.
251+
* @param bb The basic block.
252+
* @return True if `inp` is an input to the phi node along the edge originating in `bb`, false otherwise.
253+
*/
205254
predicate hasInputFromBlock(SsaVariable inp, BasicBlock bb);
206255
}
207256

257+
/**
258+
* Represents a single update to a variable in the SSA form.
259+
*/
208260
class SsaExplicitUpdate extends SsaVariable {
261+
/**
262+
* Retrieves the expression that defines the value of the variable in this update.
263+
*
264+
* @return The defining expression.
265+
*/
209266
Expr getDefiningExpr();
210267
}
211268

@@ -296,11 +353,24 @@ signature module LangSig<Semantic Sem, DeltaSig D> {
296353
}
297354

298355
signature module BoundSig<LocationSig Location, Semantic Sem, DeltaSig D> {
356+
/**
357+
* Represents a semantic bound.
358+
*/
299359
class SemBound {
360+
/**
361+
* Returns a string representation of the semantic bound.
362+
*/
300363
string toString();
301364

365+
/**
366+
* Returns the location of the semantic bound.
367+
*/
302368
Location getLocation();
303369

370+
/**
371+
* Returns the expression associated with the semantic bound, given a delta.
372+
* @param delta - The delta value.
373+
*/
304374
Sem::Expr getExpr(D::Delta delta);
305375
}
306376

0 commit comments

Comments
 (0)