Skip to content

Commit 3b03786

Browse files
aibaarspaldepind
authored andcommitted
Rust: add Locatable::fromSource
1 parent 4f14897 commit 3b03786

10 files changed

Lines changed: 12 additions & 9 deletions

File tree

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)