Skip to content

Commit d7ca065

Browse files
authored
Merge pull request github#4923 from hvitved/csharp/ssa/refactor
C#: SSA refactorings
2 parents b5d40e4 + 6cf684f commit d7ca065

21 files changed

+547
-657
lines changed

csharp/ql/src/semmle/code/csharp/commons/ConsistencyChecks.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module SsaChecks {
4949
exists(Definition def, BasicBlock bb, ControlFlow::Node rnode, ControlFlow::Node dnode, int i |
5050
def.getAReadAtNode(rnode) = read
5151
|
52-
def.definesAt(bb, i) and
52+
def.definesAt(_, bb, i) and
5353
dnode = bb.getNode(max(int j | j = i or j = 0)) and
5454
not dnode.dominates(rnode)
5555
) and

csharp/ql/src/semmle/code/csharp/controlflow/BasicBlocks.qll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,17 @@ private predicate entryBB(BasicBlock bb) {
377377
* an annotated exit node.
378378
*/
379379
class AnnotatedExitBasicBlock extends BasicBlock {
380-
AnnotatedExitBasicBlock() { this.getANode() instanceof ControlFlow::Nodes::AnnotatedExitNode }
380+
private boolean isNormal;
381+
382+
AnnotatedExitBasicBlock() {
383+
this.getANode() =
384+
any(ControlFlow::Nodes::AnnotatedExitNode n |
385+
if n.isNormal() then isNormal = true else isNormal = false
386+
)
387+
}
388+
389+
/** Holds if this block represents a normal exit. */
390+
predicate isNormal() { isNormal = true }
381391
}
382392

383393
/**

csharp/ql/src/semmle/code/csharp/controlflow/ControlFlowGraph.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ module ControlFlow {
270270
/** Gets the callable that this exit applies to. */
271271
Callable getCallable() { result = c }
272272

273-
/** Holds if this node represent a normal exit. */
273+
/** Holds if this node represents a normal exit. */
274274
predicate isNormal() { normal = true }
275275

276276
override BasicBlocks::AnnotatedExitBlock getBasicBlock() {

csharp/ql/src/semmle/code/csharp/controlflow/Guards.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,7 @@ private Ssa::Definition getAnSsaQualifier(Expr e, ControlFlow::Node cfn) {
621621
}
622622

623623
private AssignableAccess getATrackedAccess(Ssa::Definition def, ControlFlow::Node cfn) {
624-
result = def.getAReadAtNode(cfn) and
625-
not def instanceof Ssa::ImplicitUntrackedDefinition
624+
result = def.getAReadAtNode(cfn)
626625
or
627626
result = def.(Ssa::ExplicitDefinition).getADefinition().getTargetAccess() and
628627
cfn = def.getControlFlowNode()

0 commit comments

Comments
 (0)