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

Skip to content

Commit 0da80f9

Browse files
committed
rename the SSA stages to AST
1 parent c9e3a62 commit 0da80f9

8 files changed

Lines changed: 20 additions & 19 deletions

File tree

python/ql/lib/semmle/python/AstExtended.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ abstract class AstNode extends AstNode_ {
2020
*/
2121
cached
2222
ControlFlowNode getAFlowNode() {
23-
Stages::SSA::ref() and
23+
Stages::AST::ref() and
2424
py_flow_bb_node(result, this, _, _)
2525
}
2626

@@ -53,14 +53,14 @@ abstract class AstNode extends AstNode_ {
5353
*/
5454
cached
5555
AstNode getParentNode() {
56-
Stages::SSA::ref() and
56+
Stages::AST::ref() and
5757
result.getAChildNode() = this
5858
}
5959

6060
/** Whether this contains `inner` syntactically */
6161
cached
6262
predicate contains(AstNode inner) {
63-
Stages::SSA::ref() and
63+
Stages::AST::ref() and
6464
this.getAChildNode+() = inner
6565
}
6666

@@ -122,13 +122,13 @@ class Comprehension extends Comprehension_, AstNode {
122122
override string toString() { result = "Comprehension" }
123123

124124
override Location getLocation() {
125-
Stages::SSA::ref() and
125+
Stages::AST::ref() and
126126
result = Comprehension_.super.getLocation()
127127
}
128128

129129
pragma[nomagic]
130130
override AstNode getAChildNode() {
131-
Stages::SSA::ref() and
131+
Stages::AST::ref() and
132132
result = this.getASubExpression()
133133
}
134134

python/ql/lib/semmle/python/Exprs.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Expr extends Expr_, AstNode {
1111
/** Gets a textual representation of this element. */
1212
cached
1313
override string toString() {
14-
Stages::SSA::ref() and
14+
Stages::AST::ref() and
1515
result = "Expression"
1616
}
1717

python/ql/lib/semmle/python/Flow.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class ControlFlowNode extends @py_flow_node {
196196
/** Gets the scope containing this flow node */
197197
cached
198198
Scope getScope() {
199-
Stages::SSA::ref() and
199+
Stages::AST::ref() and
200200
if this.getNode() instanceof Scope
201201
then
202202
/* Entry or exit node */
@@ -621,7 +621,7 @@ class UnaryExprNode extends ControlFlowNode {
621621
class DefinitionNode extends ControlFlowNode {
622622
cached
623623
DefinitionNode() {
624-
Stages::SSA::ref() and
624+
Stages::AST::ref() and
625625
exists(Assign a | a.getATarget().getAFlowNode() = this)
626626
or
627627
exists(AnnAssign a | a.getTarget().getAFlowNode() = this and exists(a.getValue()))
@@ -689,7 +689,7 @@ class TupleNode extends SequenceNode {
689689
TupleNode() { toAst(this) instanceof Tuple }
690690

691691
override ControlFlowNode getElement(int n) {
692-
Stages::SSA::ref() and
692+
Stages::AST::ref() and
693693
exists(Tuple t | this.getNode() = t and result.getNode() = t.getElt(n)) and
694694
(
695695
result.getBasicBlock().dominates(this.getBasicBlock())
@@ -1009,22 +1009,22 @@ class BasicBlock extends @py_flow_node {
10091009
/** Whether this basic block strictly dominates the other */
10101010
cached
10111011
predicate strictlyDominates(BasicBlock other) {
1012-
Stages::SSA::ref() and
1012+
Stages::AST::ref() and
10131013
other.getImmediateDominator+() = this
10141014
}
10151015

10161016
/** Whether this basic block dominates the other */
10171017
cached
10181018
predicate dominates(BasicBlock other) {
1019-
Stages::SSA::ref() and
1019+
Stages::AST::ref() and
10201020
this = other
10211021
or
10221022
this.strictlyDominates(other)
10231023
}
10241024

10251025
cached
10261026
BasicBlock getImmediateDominator() {
1027-
Stages::SSA::ref() and
1027+
Stages::AST::ref() and
10281028
this.firstNode().getImmediateDominator().getBasicBlock() = result
10291029
}
10301030

python/ql/lib/semmle/python/Module.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private predicate transitively_imported_from_entry_point(File file) {
224224

225225
cached
226226
string moduleNameFromFile(Container file) {
227-
Stages::SSA::ref() and
227+
Stages::AST::ref() and
228228
exists(string basename |
229229
basename = moduleNameFromBase(file) and
230230
legalShortName(basename)

python/ql/lib/semmle/python/essa/Essa.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class PhiFunction extends EssaDefinition, TPhiFunction {
271271
/** Gets the input variable for this phi node on the edge `pred` -> `this.getBasicBlock()`, if any. */
272272
cached
273273
EssaVariable getInput(BasicBlock pred) {
274-
Stages::SSA::ref() and
274+
Stages::AST::ref() and
275275
result.getDefinition() = this.reachingDefinition(pred)
276276
or
277277
result.getDefinition() = this.inputEdgeRefinement(pred)

python/ql/lib/semmle/python/essa/SsaCompute.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ private module SsaComputeImpl {
309309
*/
310310
cached
311311
predicate reachesEndOfBlock(SsaSourceVariable v, BasicBlock defbb, int defindex, BasicBlock b) {
312-
Stages::SSA::ref() and
312+
Stages::AST::ref() and
313313
Liveness::liveAtExit(v, b) and
314314
(
315315
defbb = b and

python/ql/lib/semmle/python/essa/SsaDefinitions.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module SsaSource {
1212
/** Holds if `v` is used as the receiver in a method call. */
1313
cached
1414
predicate method_call_refinement(Variable v, ControlFlowNode use, CallNode call) {
15-
Stages::SSA::ref() and
15+
Stages::AST::ref() and
1616
use = v.getAUse() and
1717
call.getFunction().(AttrNode).getObject() = use and
1818
not test_contains(_, call)

python/ql/lib/semmle/python/internal/CachedStages.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
*/
3232
module Stages {
3333
/**
34-
* The `SSA` stage.
34+
* The `AST` stage.
35+
* Computes predicates based on the AST.
36+
* These include SSA and basic-blocks.
3537
*/
3638
cached
37-
module SSA {
38-
// TODO: This is more a "basic AST", not a "SSA" stage.
39+
module AST {
3940
/**
4041
* Always holds.
4142
* Ensures that a predicate is evaluated as part of the Ast stage.

0 commit comments

Comments
 (0)