codeql-development-mcp-server 2.25.0 → 2.25.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/codeql-development-mcp-server.js +138160 -7960
  2. package/dist/codeql-development-mcp-server.js.map +4 -4
  3. package/package.json +4 -3
  4. package/ql/README.md +1 -0
  5. package/ql/actions/tools/src/codeql-pack.lock.yml +14 -14
  6. package/ql/actions/tools/src/codeql-pack.yml +2 -2
  7. package/ql/cpp/tools/src/codeql-pack.lock.yml +12 -12
  8. package/ql/cpp/tools/src/codeql-pack.yml +2 -2
  9. package/ql/csharp/tools/src/codeql-pack.lock.yml +10 -10
  10. package/ql/csharp/tools/src/codeql-pack.yml +2 -2
  11. package/ql/go/tools/src/codeql-pack.lock.yml +10 -10
  12. package/ql/go/tools/src/codeql-pack.yml +2 -2
  13. package/ql/java/tools/src/codeql-pack.lock.yml +14 -14
  14. package/ql/java/tools/src/codeql-pack.yml +2 -2
  15. package/ql/javascript/tools/src/codeql-pack.lock.yml +13 -13
  16. package/ql/javascript/tools/src/codeql-pack.yml +2 -2
  17. package/ql/python/tools/src/codeql-pack.lock.yml +13 -13
  18. package/ql/python/tools/src/codeql-pack.yml +2 -2
  19. package/ql/ruby/tools/src/codeql-pack.lock.yml +10 -10
  20. package/ql/ruby/tools/src/codeql-pack.yml +2 -2
  21. package/ql/rust/tools/src/CallGraphFrom/CallGraphFrom.md +48 -0
  22. package/ql/rust/tools/src/CallGraphFrom/CallGraphFrom.ql +38 -0
  23. package/ql/rust/tools/src/CallGraphFromTo/CallGraphFromTo.md +48 -0
  24. package/ql/rust/tools/src/CallGraphFromTo/CallGraphFromTo.ql +69 -0
  25. package/ql/rust/tools/src/CallGraphTo/CallGraphTo.md +47 -0
  26. package/ql/rust/tools/src/CallGraphTo/CallGraphTo.ql +47 -0
  27. package/ql/rust/tools/src/ExternalPredicates.qll +14 -0
  28. package/ql/rust/tools/src/PrintAST/PrintAST.md +59 -0
  29. package/ql/rust/tools/src/PrintAST/PrintAST.ql +46 -0
  30. package/ql/rust/tools/src/PrintCFG/PrintCFG.md +56 -0
  31. package/ql/rust/tools/src/PrintCFG/PrintCFG.ql +58 -0
  32. package/ql/rust/tools/src/codeql-pack.lock.yml +28 -0
  33. package/ql/rust/tools/src/codeql-pack.yml +6 -0
  34. package/ql/swift/tools/src/codeql-pack.lock.yml +10 -10
  35. package/ql/swift/tools/src/codeql-pack.yml +2 -2
  36. package/scripts/setup-packs.sh +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeql-development-mcp-server",
3
- "version": "2.25.0",
3
+ "version": "2.25.1-next.2",
4
4
  "description": "An MCP server supporting LLM requests for CodeQL development tools and resources.",
5
5
  "main": "dist/codeql-development-mcp-server.js",
6
6
  "type": "module",
@@ -18,6 +18,7 @@
18
18
  "ql/javascript/tools/src/",
19
19
  "ql/python/tools/src/",
20
20
  "ql/ruby/tools/src/",
21
+ "ql/rust/tools/src/",
21
22
  "ql/swift/tools/src/",
22
23
  "scripts/setup-packs.sh",
23
24
  "package.json",
@@ -40,7 +41,7 @@
40
41
  "typescript"
41
42
  ],
42
43
  "author": "@github/ps-codeql",
43
- "license": "SEE LICENSE IN LICENSE",
44
+ "license": "LicenseRef-CodeQL-Terms",
44
45
  "repository": {
45
46
  "type": "git",
46
47
  "url": "git+https://github.com/advanced-security/codeql-development-mcp-server.git",
@@ -61,7 +62,7 @@
61
62
  "dotenv": "^17.3.1",
62
63
  "express": "^5.2.1",
63
64
  "js-yaml": "^4.1.1",
64
- "lowdb": "^7.0.1",
65
+ "sql.js": "^1.14.1",
65
66
  "zod": "^3.25.76"
66
67
  },
67
68
  "devDependencies": {
package/ql/README.md CHANGED
@@ -35,6 +35,7 @@ Currently supported languages:
35
35
  - `javascript/` - JavaScript/TypeScript
36
36
  - `python/` - Python
37
37
  - `ruby/` - Ruby
38
+ - `rust/` - Rust
38
39
  - `swift/` - Swift
39
40
 
40
41
  ## Testing
@@ -2,31 +2,31 @@
2
2
  lockVersion: 1.0.0
3
3
  dependencies:
4
4
  codeql/actions-all:
5
- version: 0.4.30
5
+ version: 0.4.32
6
6
  codeql/concepts:
7
- version: 0.0.18
7
+ version: 0.0.20
8
8
  codeql/controlflow:
9
- version: 2.0.28
9
+ version: 2.0.30
10
10
  codeql/dataflow:
11
- version: 2.1.0
11
+ version: 2.1.2
12
12
  codeql/javascript-all:
13
- version: 2.6.24
13
+ version: 2.6.26
14
14
  codeql/mad:
15
- version: 1.0.44
15
+ version: 1.0.46
16
16
  codeql/regex:
17
- version: 1.0.44
17
+ version: 1.0.46
18
18
  codeql/ssa:
19
- version: 2.0.20
19
+ version: 2.0.22
20
20
  codeql/threat-models:
21
- version: 1.0.44
21
+ version: 1.0.46
22
22
  codeql/tutorial:
23
- version: 1.0.44
23
+ version: 1.0.46
24
24
  codeql/typetracking:
25
- version: 2.0.28
25
+ version: 2.0.30
26
26
  codeql/util:
27
- version: 2.0.31
27
+ version: 2.0.33
28
28
  codeql/xml:
29
- version: 1.0.44
29
+ version: 1.0.46
30
30
  codeql/yaml:
31
- version: 1.0.44
31
+ version: 1.0.46
32
32
  compiled: false
@@ -1,6 +1,6 @@
1
1
  name: advanced-security/ql-mcp-actions-tools-src
2
- version: 2.25.0
2
+ version: 2.25.1-next.2
3
3
  description: 'Queries for codeql-development-mcp-server tools for actions language'
4
4
  library: false
5
5
  dependencies:
6
- codeql/actions-all: 0.4.30
6
+ codeql/actions-all: 0.4.32
@@ -2,27 +2,27 @@
2
2
  lockVersion: 1.0.0
3
3
  dependencies:
4
4
  codeql/controlflow:
5
- version: 2.0.28
5
+ version: 2.0.30
6
6
  codeql/cpp-all:
7
- version: 8.0.1
7
+ version: 8.0.3
8
8
  codeql/dataflow:
9
- version: 2.1.0
9
+ version: 2.1.2
10
10
  codeql/mad:
11
- version: 1.0.44
11
+ version: 1.0.46
12
12
  codeql/quantum:
13
- version: 0.0.22
13
+ version: 0.0.24
14
14
  codeql/rangeanalysis:
15
- version: 1.0.44
15
+ version: 1.0.46
16
16
  codeql/ssa:
17
- version: 2.0.20
17
+ version: 2.0.22
18
18
  codeql/tutorial:
19
- version: 1.0.44
19
+ version: 1.0.46
20
20
  codeql/typeflow:
21
- version: 1.0.44
21
+ version: 1.0.46
22
22
  codeql/typetracking:
23
- version: 2.0.28
23
+ version: 2.0.30
24
24
  codeql/util:
25
- version: 2.0.31
25
+ version: 2.0.33
26
26
  codeql/xml:
27
- version: 1.0.44
27
+ version: 1.0.46
28
28
  compiled: false
@@ -1,6 +1,6 @@
1
1
  name: advanced-security/ql-mcp-cpp-tools-src
2
- version: 2.25.0
2
+ version: 2.25.1-next.2
3
3
  description: 'Queries for codeql-development-mcp-server tools for cpp language'
4
4
  library: false
5
5
  dependencies:
6
- codeql/cpp-all: 8.0.1
6
+ codeql/cpp-all: 8.0.3
@@ -2,23 +2,23 @@
2
2
  lockVersion: 1.0.0
3
3
  dependencies:
4
4
  codeql/controlflow:
5
- version: 2.0.28
5
+ version: 2.0.30
6
6
  codeql/csharp-all:
7
- version: 5.4.9
7
+ version: 5.4.11
8
8
  codeql/dataflow:
9
- version: 2.1.0
9
+ version: 2.1.2
10
10
  codeql/mad:
11
- version: 1.0.44
11
+ version: 1.0.46
12
12
  codeql/ssa:
13
- version: 2.0.20
13
+ version: 2.0.22
14
14
  codeql/threat-models:
15
- version: 1.0.44
15
+ version: 1.0.46
16
16
  codeql/tutorial:
17
- version: 1.0.44
17
+ version: 1.0.46
18
18
  codeql/typetracking:
19
- version: 2.0.28
19
+ version: 2.0.30
20
20
  codeql/util:
21
- version: 2.0.31
21
+ version: 2.0.33
22
22
  codeql/xml:
23
- version: 1.0.44
23
+ version: 1.0.46
24
24
  compiled: false
@@ -1,6 +1,6 @@
1
1
  name: advanced-security/ql-mcp-csharp-tools-src
2
- version: 2.25.0
2
+ version: 2.25.1-next.2
3
3
  description: 'Queries for codeql-development-mcp-server tools for csharp language'
4
4
  library: false
5
5
  dependencies:
6
- codeql/csharp-all: 5.4.9
6
+ codeql/csharp-all: 5.4.11
@@ -2,23 +2,23 @@
2
2
  lockVersion: 1.0.0
3
3
  dependencies:
4
4
  codeql/concepts:
5
- version: 0.0.18
5
+ version: 0.0.20
6
6
  codeql/controlflow:
7
- version: 2.0.28
7
+ version: 2.0.30
8
8
  codeql/dataflow:
9
- version: 2.1.0
9
+ version: 2.1.2
10
10
  codeql/go-all:
11
- version: 7.0.2
11
+ version: 7.0.4
12
12
  codeql/mad:
13
- version: 1.0.44
13
+ version: 1.0.46
14
14
  codeql/ssa:
15
- version: 2.0.20
15
+ version: 2.0.22
16
16
  codeql/threat-models:
17
- version: 1.0.44
17
+ version: 1.0.46
18
18
  codeql/tutorial:
19
- version: 1.0.44
19
+ version: 1.0.46
20
20
  codeql/typetracking:
21
- version: 2.0.28
21
+ version: 2.0.30
22
22
  codeql/util:
23
- version: 2.0.31
23
+ version: 2.0.33
24
24
  compiled: false
@@ -1,6 +1,6 @@
1
1
  name: advanced-security/ql-mcp-go-tools-src
2
- version: 2.25.0
2
+ version: 2.25.1-next.2
3
3
  description: 'Queries for codeql-development-mcp-server tools for go language'
4
4
  library: false
5
5
  dependencies:
6
- codeql/go-all: 7.0.2
6
+ codeql/go-all: 7.0.4
@@ -2,31 +2,31 @@
2
2
  lockVersion: 1.0.0
3
3
  dependencies:
4
4
  codeql/controlflow:
5
- version: 2.0.28
5
+ version: 2.0.30
6
6
  codeql/dataflow:
7
- version: 2.1.0
7
+ version: 2.1.2
8
8
  codeql/java-all:
9
- version: 9.0.0
9
+ version: 9.0.2
10
10
  codeql/mad:
11
- version: 1.0.44
11
+ version: 1.0.46
12
12
  codeql/quantum:
13
- version: 0.0.22
13
+ version: 0.0.24
14
14
  codeql/rangeanalysis:
15
- version: 1.0.44
15
+ version: 1.0.46
16
16
  codeql/regex:
17
- version: 1.0.44
17
+ version: 1.0.46
18
18
  codeql/ssa:
19
- version: 2.0.20
19
+ version: 2.0.22
20
20
  codeql/threat-models:
21
- version: 1.0.44
21
+ version: 1.0.46
22
22
  codeql/tutorial:
23
- version: 1.0.44
23
+ version: 1.0.46
24
24
  codeql/typeflow:
25
- version: 1.0.44
25
+ version: 1.0.46
26
26
  codeql/typetracking:
27
- version: 2.0.28
27
+ version: 2.0.30
28
28
  codeql/util:
29
- version: 2.0.31
29
+ version: 2.0.33
30
30
  codeql/xml:
31
- version: 1.0.44
31
+ version: 1.0.46
32
32
  compiled: false
@@ -1,6 +1,6 @@
1
1
  name: advanced-security/ql-mcp-java-tools-src
2
- version: 2.25.0
2
+ version: 2.25.1-next.2
3
3
  description: 'Queries for codeql-development-mcp-server tools for java language'
4
4
  library: false
5
5
  dependencies:
6
- codeql/java-all: 9.0.0
6
+ codeql/java-all: 9.0.2
@@ -2,29 +2,29 @@
2
2
  lockVersion: 1.0.0
3
3
  dependencies:
4
4
  codeql/concepts:
5
- version: 0.0.18
5
+ version: 0.0.20
6
6
  codeql/controlflow:
7
- version: 2.0.28
7
+ version: 2.0.30
8
8
  codeql/dataflow:
9
- version: 2.1.0
9
+ version: 2.1.2
10
10
  codeql/javascript-all:
11
- version: 2.6.24
11
+ version: 2.6.26
12
12
  codeql/mad:
13
- version: 1.0.44
13
+ version: 1.0.46
14
14
  codeql/regex:
15
- version: 1.0.44
15
+ version: 1.0.46
16
16
  codeql/ssa:
17
- version: 2.0.20
17
+ version: 2.0.22
18
18
  codeql/threat-models:
19
- version: 1.0.44
19
+ version: 1.0.46
20
20
  codeql/tutorial:
21
- version: 1.0.44
21
+ version: 1.0.46
22
22
  codeql/typetracking:
23
- version: 2.0.28
23
+ version: 2.0.30
24
24
  codeql/util:
25
- version: 2.0.31
25
+ version: 2.0.33
26
26
  codeql/xml:
27
- version: 1.0.44
27
+ version: 1.0.46
28
28
  codeql/yaml:
29
- version: 1.0.44
29
+ version: 1.0.46
30
30
  compiled: false
@@ -1,6 +1,6 @@
1
1
  name: advanced-security/ql-mcp-javascript-tools-src
2
- version: 2.25.0
2
+ version: 2.25.1-next.2
3
3
  description: 'Queries for codeql-development-mcp-server tools for javascript language'
4
4
  library: false
5
5
  dependencies:
6
- codeql/javascript-all: 2.6.24
6
+ codeql/javascript-all: 2.6.26
@@ -2,29 +2,29 @@
2
2
  lockVersion: 1.0.0
3
3
  dependencies:
4
4
  codeql/concepts:
5
- version: 0.0.18
5
+ version: 0.0.20
6
6
  codeql/controlflow:
7
- version: 2.0.28
7
+ version: 2.0.30
8
8
  codeql/dataflow:
9
- version: 2.1.0
9
+ version: 2.1.2
10
10
  codeql/mad:
11
- version: 1.0.44
11
+ version: 1.0.46
12
12
  codeql/python-all:
13
- version: 7.0.1
13
+ version: 7.0.3
14
14
  codeql/regex:
15
- version: 1.0.44
15
+ version: 1.0.46
16
16
  codeql/ssa:
17
- version: 2.0.20
17
+ version: 2.0.22
18
18
  codeql/threat-models:
19
- version: 1.0.44
19
+ version: 1.0.46
20
20
  codeql/tutorial:
21
- version: 1.0.44
21
+ version: 1.0.46
22
22
  codeql/typetracking:
23
- version: 2.0.28
23
+ version: 2.0.30
24
24
  codeql/util:
25
- version: 2.0.31
25
+ version: 2.0.33
26
26
  codeql/xml:
27
- version: 1.0.44
27
+ version: 1.0.46
28
28
  codeql/yaml:
29
- version: 1.0.44
29
+ version: 1.0.46
30
30
  compiled: false
@@ -1,6 +1,6 @@
1
1
  name: advanced-security/ql-mcp-python-tools-src
2
- version: 2.25.0
2
+ version: 2.25.1-next.2
3
3
  description: 'Queries for codeql-development-mcp-server tools for python language'
4
4
  library: false
5
5
  dependencies:
6
- codeql/python-all: 7.0.1
6
+ codeql/python-all: 7.0.3
@@ -2,23 +2,23 @@
2
2
  lockVersion: 1.0.0
3
3
  dependencies:
4
4
  codeql/concepts:
5
- version: 0.0.18
5
+ version: 0.0.20
6
6
  codeql/controlflow:
7
- version: 2.0.28
7
+ version: 2.0.30
8
8
  codeql/dataflow:
9
- version: 2.1.0
9
+ version: 2.1.2
10
10
  codeql/mad:
11
- version: 1.0.44
11
+ version: 1.0.46
12
12
  codeql/regex:
13
- version: 1.0.44
13
+ version: 1.0.46
14
14
  codeql/ruby-all:
15
- version: 5.1.12
15
+ version: 5.1.14
16
16
  codeql/ssa:
17
- version: 2.0.20
17
+ version: 2.0.22
18
18
  codeql/tutorial:
19
- version: 1.0.44
19
+ version: 1.0.46
20
20
  codeql/typetracking:
21
- version: 2.0.28
21
+ version: 2.0.30
22
22
  codeql/util:
23
- version: 2.0.31
23
+ version: 2.0.33
24
24
  compiled: false
@@ -1,6 +1,6 @@
1
1
  name: advanced-security/ql-mcp-ruby-tools-src
2
- version: 2.25.0
2
+ version: 2.25.1-next.2
3
3
  description: 'Queries for codeql-development-mcp-server tools for ruby language'
4
4
  library: false
5
5
  dependencies:
6
- codeql/ruby-all: 5.1.12
6
+ codeql/ruby-all: 5.1.14
@@ -0,0 +1,48 @@
1
+ # CallGraphFrom for Rust
2
+
3
+ Displays calls made from a specified function, showing the call graph outbound from the source function.
4
+
5
+ ## Overview
6
+
7
+ This query identifies all function calls made within the body of a named function, producing an outbound call graph. Given a source function name, it reports each call site and the callee, which is useful for understanding function dependencies and call chains.
8
+
9
+ The query accepts function names via an external predicate (`sourceFunction`).
10
+
11
+ ## Use Cases
12
+
13
+ This query is primarily used for:
14
+
15
+ - Mapping outbound dependencies of a specific function
16
+ - Understanding what a function calls and in what order
17
+ - Analyzing call chains for refactoring or security review
18
+
19
+ ## Example
20
+
21
+ The following Rust code demonstrates outbound calls from `source_func`:
22
+
23
+ ```rust
24
+ fn helper1() {}
25
+
26
+ fn helper2() {
27
+ helper1();
28
+ }
29
+
30
+ fn source_func() { // Source function for analysis
31
+ helper1();
32
+ helper2();
33
+ }
34
+ ```
35
+
36
+ Running with `sourceFunction = "source_func"` produces results showing each call site with the message pattern ``Call from `source_func` to `helper1` ``.
37
+
38
+ ## Output Format
39
+
40
+ The query is a `@kind problem` query producing rows of:
41
+
42
+ - ``select call, "Call from `source` to `callee`"``
43
+
44
+ ## References
45
+
46
+ - [Rust Functions](https://doc.rust-lang.org/book/ch03-03-how-functions-work.html)
47
+ - [CodeQL Call Graph Analysis](https://codeql.github.com/docs/writing-codeql-queries/about-data-flow-analysis/)
48
+ - [CodeQL Library for Rust](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-rust/)
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @name Call Graph From for rust
3
+ * @description Displays calls made from a specified function, showing the call graph outbound from the source function.
4
+ * @id rust/tools/call-graph-from
5
+ * @kind problem
6
+ * @problem.severity recommendation
7
+ * @tags call-graph
8
+ */
9
+
10
+ import rust
11
+ import ExternalPredicates
12
+
13
+ /**
14
+ * Gets a single source function name from the comma-separated list.
15
+ */
16
+ string getSourceFunctionName() {
17
+ exists(string s | sourceFunction(s) | result = s.splitAt(",").trim())
18
+ }
19
+
20
+ /**
21
+ * Gets a function by matching against the selected source function names.
22
+ */
23
+ Function getSourceFunction() { result.getName().getText() = getSourceFunctionName() }
24
+
25
+ /**
26
+ * Gets the name of the called function.
27
+ */
28
+ string getCalleeName(CallExpr call) {
29
+ if exists(call.getResolvedTarget().(Function).getName())
30
+ then result = call.getResolvedTarget().(Function).getName().getText()
31
+ else result = call.toString()
32
+ }
33
+
34
+ from CallExpr call, Function source
35
+ where
36
+ call.getEnclosingCallable() = source and
37
+ source = getSourceFunction()
38
+ select call, "Call from `" + source.getName().getText() + "` to `" + getCalleeName(call) + "`"
@@ -0,0 +1,48 @@
1
+ # CallGraphFromTo for Rust
2
+
3
+ Displays calls on reachable paths from a source function to a target function, showing transitive call graph connectivity.
4
+
5
+ ## Overview
6
+
7
+ This query identifies all call sites on paths that transitively connect a source function to a target function. It uses the `calls*` transitive closure to find functions reachable from the source that can also reach the target, then reports calls within those functions.
8
+
9
+ The query accepts both source and target function names via external predicates (`sourceFunction` and `targetFunction`).
10
+
11
+ ## Use Cases
12
+
13
+ This query is primarily used for:
14
+
15
+ - Understanding transitive call chains between two functions
16
+ - Analyzing reachability in the call graph
17
+ - Identifying intermediate functions on critical paths
18
+ - Security analysis of data flow through function boundaries
19
+
20
+ ## Example
21
+
22
+ The following Rust code demonstrates a transitive call chain:
23
+
24
+ ```rust
25
+ fn target() {}
26
+
27
+ fn intermediate() {
28
+ target();
29
+ }
30
+
31
+ fn source() {
32
+ intermediate();
33
+ }
34
+ ```
35
+
36
+ Running with `sourceFunction = "source"` and `targetFunction = "target"` produces results showing each call site on the path with the message pattern ``Reachable call from `intermediate` to `target` ``.
37
+
38
+ ## Output Format
39
+
40
+ The query is a `@kind problem` query producing rows of:
41
+
42
+ - ``select call, "Reachable call from `caller` to `callee`"``
43
+
44
+ ## References
45
+
46
+ - [Rust Functions](https://doc.rust-lang.org/book/ch03-03-how-functions-work.html)
47
+ - [CodeQL Call Graph Analysis](https://codeql.github.com/docs/writing-codeql-queries/about-data-flow-analysis/)
48
+ - [CodeQL Library for Rust](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-rust/)
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @name Call Graph From To for rust
3
+ * @description Displays calls on reachable paths from a source function to a target function, showing transitive call graph connectivity.
4
+ * @id rust/tools/call-graph-from-to
5
+ * @kind problem
6
+ * @problem.severity recommendation
7
+ * @tags call-graph
8
+ */
9
+
10
+ import rust
11
+ import ExternalPredicates
12
+
13
+ /**
14
+ * Gets a single source function name from the comma-separated list.
15
+ */
16
+ string getSourceFunctionName() {
17
+ exists(string s | sourceFunction(s) | result = s.splitAt(",").trim())
18
+ }
19
+
20
+ /**
21
+ * Gets a single target function name from the comma-separated list.
22
+ */
23
+ string getTargetFunctionName() {
24
+ exists(string s | targetFunction(s) | result = s.splitAt(",").trim())
25
+ }
26
+
27
+ /**
28
+ * Gets a function by matching against the selected source function names.
29
+ */
30
+ Function getSourceFunction() { result.getName().getText() = getSourceFunctionName() }
31
+
32
+ /**
33
+ * Gets a function by matching against the selected target function names.
34
+ */
35
+ Function getTargetFunction() { result.getName().getText() = getTargetFunctionName() }
36
+
37
+ /**
38
+ * Holds if function `caller` directly calls function `callee`.
39
+ */
40
+ predicate calls(Function caller_, Function callee_) {
41
+ exists(CallExpr c |
42
+ c.getEnclosingCallable() = caller_ and
43
+ c.getResolvedTarget().(Function) = callee_
44
+ )
45
+ }
46
+
47
+ /**
48
+ * Gets the name of the called function.
49
+ */
50
+ string getCalleeName(CallExpr call) {
51
+ if exists(call.getResolvedTarget().(Function).getName())
52
+ then result = call.getResolvedTarget().(Function).getName().getText()
53
+ else result = call.toString()
54
+ }
55
+
56
+ from CallExpr call, Function caller
57
+ where
58
+ call.getEnclosingCallable() = caller and
59
+ exists(Function source, Function target |
60
+ source = getSourceFunction() and
61
+ target = getTargetFunction() and
62
+ calls*(source, caller) and
63
+ exists(Function callee |
64
+ call.getResolvedTarget().(Function) = callee and
65
+ calls*(callee, target)
66
+ )
67
+ )
68
+ select call,
69
+ "Reachable call from `" + caller.getName().getText() + "` to `" + getCalleeName(call) + "`"