Skip to content

Commit 66ab3a8

Browse files
committed
Rust: add Locatable::fromSource
1 parent 9814aef commit 66ab3a8

File tree

10 files changed

+12
-9
lines changed

10 files changed

+12
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Function f
4-
where exists(f.getLocation().getFile().getRelativePath())
4+
where f.fromSource()
55
select f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Function f
4-
where exists(f.getLocation().getFile().getRelativePath())
4+
where f.fromSource()
55
select f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Function f
4-
where exists(f.getLocation().getFile().getRelativePath())
4+
where f.fromSource()
55
select f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Function f
4-
where exists(f.getLocation().getFile().getRelativePath())
4+
where f.fromSource()
55
select f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Function f
4-
where exists(f.getLocation().getFile().getRelativePath())
4+
where f.fromSource()
55
select f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Function f
4-
where exists(f.getLocation().getFile().getRelativePath())
4+
where f.fromSource()
55
select f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Function f
4-
where exists(f.getLocation().getFile().getRelativePath())
4+
where f.fromSource()
55
select f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Function f
4-
where exists(f.getLocation().getFile().getRelativePath())
4+
where f.fromSource()
55
select f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rust
22

33
from Function f
4-
where exists(f.getLocation().getFile().getRelativePath())
4+
where f.fromSource()
55
select f

rust/ql/lib/codeql/rust/elements/internal/LocatableImpl.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ module Impl {
4141
* Gets the primary file where this element occurs.
4242
*/
4343
File getFile() { result = this.getLocation().getFile() }
44+
45+
/** Holds if this element is from source code. */
46+
predicate fromSource() { exists(this.getFile().getRelativePath()) }
4447
}
4548

4649
/** Gets the non-synthesized location of `l`, if any. */

0 commit comments

Comments
 (0)