Skip to content

Commit c2f0039

Browse files
committed
Debug predicates for missing def/use nodes
1 parent dac7479 commit c2f0039

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ module API {
795795
* Holds if `rhs` is the right-hand side of a definition of a node that should have an
796796
* incoming edge from `base` labeled `lbl` in the API graph.
797797
*/
798-
private predicate rhs(TApiNode base, Label::ApiLabel lbl, DataFlow::Node rhs) {
798+
predicate rhs(TApiNode base, Label::ApiLabel lbl, DataFlow::Node rhs) {
799799
hasSemantics(rhs) and
800800
(
801801
base = MkRoot() and
@@ -1031,7 +1031,7 @@ module API {
10311031
* Holds if `ref` is a use of a node that should have an incoming edge from `base` labeled
10321032
* `lbl` in the API graph.
10331033
*/
1034-
private predicate use(TApiNode base, Label::ApiLabel lbl, DataFlow::Node ref) {
1034+
predicate use(TApiNode base, Label::ApiLabel lbl, DataFlow::Node ref) {
10351035
hasSemantics(ref) and
10361036
(
10371037
base = MkRoot() and
@@ -1638,6 +1638,16 @@ module API {
16381638
import Cached
16391639

16401640
private module Debug {
1641+
query predicate missingDefNode(DataFlow::Node node) {
1642+
Stage1::rhs(_, _, node) and
1643+
not exists(MkDef(node))
1644+
}
1645+
1646+
query predicate missingUseNode(DataFlow::Node node) {
1647+
Stage1::use(_, _, node) and
1648+
not exists(MkUse(node))
1649+
}
1650+
16411651
query predicate lostEdge(Node pred, Label::ApiLabel lbl, Node succ) {
16421652
Stage1::edge(pred, lbl, succ) and
16431653
not Cached::edge(pred, lbl, succ)

0 commit comments

Comments
 (0)