Skip to content

Commit 63f76b1

Browse files
committed
C#: Uniform treatment of all SSA definitions
1 parent 8d77f4b commit 63f76b1

File tree

14 files changed

+450
-437
lines changed

14 files changed

+450
-437
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() {

0 commit comments

Comments
 (0)