Skip to content

Commit 46197e6

Browse files
committed
Address review comments
1 parent dbb3d3d commit 46197e6

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

csharp/ql/test/library-tests/controlflow/graph/BasicBlock.ql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ import csharp
22
import Common
33

44
from SourceBasicBlock bb
5-
where not bb.getFirstNode().getElement().fromLibrary()
65
select bb.getFirstNode(), bb.getLastNode(), bb.length()

csharp/ql/test/library-tests/controlflow/graph/Common.qll

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ class SourceControlFlowElement extends ControlFlowElement {
1111
}
1212

1313
class SourceControlFlowNode extends ControlFlow::Node {
14-
SourceControlFlowNode() { not this.getLocation().getFile() instanceof StubFile }
14+
SourceControlFlowNode() {
15+
not this.getLocation().getFile() instanceof StubFile and
16+
not this.getLocation().getFile().fromLibrary()
17+
}
1518
}
1619

1720
class SourceBasicBlock extends ControlFlow::BasicBlock {
18-
SourceBasicBlock() { not this.getLocation().getFile() instanceof StubFile }
21+
SourceBasicBlock() {
22+
not this.getLocation().getFile() instanceof StubFile and
23+
not this.getLocation().getFile().fromLibrary()
24+
}
1925
}
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
import csharp
22
import Common
33

4-
/** Holds if `node` is not from a library. */
5-
private predicate isSourceBased(SourceControlFlowNode node) { not node.getElement().fromLibrary() }
6-
74
query predicate dominance(SourceControlFlowNode dom, SourceControlFlowNode node) {
8-
isSourceBased(dom) and
95
dom.strictlyDominates(node) and
106
dom.getASuccessor() = node
117
}
128

139
query predicate postDominance(SourceControlFlowNode dom, SourceControlFlowNode node) {
14-
isSourceBased(dom) and
1510
dom.strictlyPostDominates(node) and
1611
dom.getAPredecessor() = node
1712
}
1813

19-
query predicate blockDominance(SourceBasicBlock dom, SourceBasicBlock bb) {
20-
isSourceBased(dom.getFirstNode()) and dom.dominates(bb)
21-
}
14+
query predicate blockDominance(SourceBasicBlock dom, SourceBasicBlock bb) { dom.dominates(bb) }
2215

2316
query predicate postBlockDominance(SourceBasicBlock dom, SourceBasicBlock bb) {
24-
isSourceBased(dom.getFirstNode()) and dom.postDominates(bb)
17+
dom.postDominates(bb)
2518
}

csharp/ql/test/library-tests/controlflow/graph/NodeGraph.ql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Common
44
query predicate edges(
55
SourceControlFlowNode node, SourceControlFlowNode successor, string attr, string val
66
) {
7-
not node.getElement().fromLibrary() and
87
exists(ControlFlow::SuccessorType t | successor = node.getASuccessorByType(t) |
98
attr = "semmle.label" and
109
val = t.toString()

0 commit comments

Comments
 (0)