mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
Address review comments
This commit is contained in:
@@ -2,5 +2,4 @@ import csharp
|
||||
import Common
|
||||
|
||||
from SourceBasicBlock bb
|
||||
where not bb.getFirstNode().getElement().fromLibrary()
|
||||
select bb.getFirstNode(), bb.getLastNode(), bb.length()
|
||||
|
||||
@@ -11,9 +11,15 @@ class SourceControlFlowElement extends ControlFlowElement {
|
||||
}
|
||||
|
||||
class SourceControlFlowNode extends ControlFlow::Node {
|
||||
SourceControlFlowNode() { not this.getLocation().getFile() instanceof StubFile }
|
||||
SourceControlFlowNode() {
|
||||
not this.getLocation().getFile() instanceof StubFile and
|
||||
not this.getLocation().getFile().fromLibrary()
|
||||
}
|
||||
}
|
||||
|
||||
class SourceBasicBlock extends ControlFlow::BasicBlock {
|
||||
SourceBasicBlock() { not this.getLocation().getFile() instanceof StubFile }
|
||||
SourceBasicBlock() {
|
||||
not this.getLocation().getFile() instanceof StubFile and
|
||||
not this.getLocation().getFile().fromLibrary()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
import csharp
|
||||
import Common
|
||||
|
||||
/** Holds if `node` is not from a library. */
|
||||
private predicate isSourceBased(SourceControlFlowNode node) { not node.getElement().fromLibrary() }
|
||||
|
||||
query predicate dominance(SourceControlFlowNode dom, SourceControlFlowNode node) {
|
||||
isSourceBased(dom) and
|
||||
dom.strictlyDominates(node) and
|
||||
dom.getASuccessor() = node
|
||||
}
|
||||
|
||||
query predicate postDominance(SourceControlFlowNode dom, SourceControlFlowNode node) {
|
||||
isSourceBased(dom) and
|
||||
dom.strictlyPostDominates(node) and
|
||||
dom.getAPredecessor() = node
|
||||
}
|
||||
|
||||
query predicate blockDominance(SourceBasicBlock dom, SourceBasicBlock bb) {
|
||||
isSourceBased(dom.getFirstNode()) and dom.dominates(bb)
|
||||
}
|
||||
query predicate blockDominance(SourceBasicBlock dom, SourceBasicBlock bb) { dom.dominates(bb) }
|
||||
|
||||
query predicate postBlockDominance(SourceBasicBlock dom, SourceBasicBlock bb) {
|
||||
isSourceBased(dom.getFirstNode()) and dom.postDominates(bb)
|
||||
dom.postDominates(bb)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import Common
|
||||
query predicate edges(
|
||||
SourceControlFlowNode node, SourceControlFlowNode successor, string attr, string val
|
||||
) {
|
||||
not node.getElement().fromLibrary() and
|
||||
exists(ControlFlow::SuccessorType t | successor = node.getASuccessorByType(t) |
|
||||
attr = "semmle.label" and
|
||||
val = t.toString()
|
||||
|
||||
Reference in New Issue
Block a user