Skip to content

Commit f2b8ac1

Browse files
authored
Merge pull request #20351 from hvitved/rust/summarized-callable-location
Rust: Assign locations to all `DataFlowCallable`s
2 parents fb13873 + dff5ed7 commit f2b8ac1

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ final class DataFlowCallable extends TDataFlowCallable {
5353
}
5454

5555
/** Gets the location of this callable. */
56-
Location getLocation() { result = this.asCfgScope().getLocation() }
56+
Location getLocation() {
57+
result = [this.asCfgScope().getLocation(), this.asSummarizedCallable().getLocation()]
58+
}
5759
}
5860

5961
final class DataFlowCall extends TDataFlowCall {

rust/ql/test/library-tests/dataflow/global/viableCallable.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@
9898
| main.rs:326:17:326:25 | source(...) | main.rs:1:1:3:1 | fn source |
9999
| main.rs:327:9:327:15 | sink(...) | main.rs:5:1:7:1 | fn sink |
100100
| main.rs:330:5:330:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
101-
| main.rs:334:13:334:55 | ...::block_on(...) | file://:0:0:0:0 | fn block_on |
101+
| main.rs:334:13:334:55 | ...::block_on(...) | {EXTERNAL LOCATION} | fn block_on |
102102
| main.rs:334:41:334:54 | async_source(...) | main.rs:315:1:319:1 | fn async_source |
103103
| main.rs:335:5:335:11 | sink(...) | main.rs:5:1:7:1 | fn sink |
104-
| main.rs:337:5:337:62 | ...::block_on(...) | file://:0:0:0:0 | fn block_on |
104+
| main.rs:337:5:337:62 | ...::block_on(...) | {EXTERNAL LOCATION} | fn block_on |
105105
| main.rs:337:33:337:61 | test_async_await_async_part(...) | main.rs:321:1:331:1 | fn test_async_await_async_part |
106106
| main.rs:341:5:341:22 | data_out_of_call(...) | main.rs:16:1:19:1 | fn data_out_of_call |
107107
| main.rs:342:5:342:35 | data_out_of_call_side_effect1(...) | main.rs:35:1:40:1 | fn data_out_of_call_side_effect1 |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
query: viableCallable.ql
2+
postprocess: utils/test/ExternalLocationPostProcessing.ql

0 commit comments

Comments
 (0)