Merge pull request #19028 from hvitved/rust/crate-locatable

This commit is contained in:
Tom Hvitved
2025-03-14 20:27:33 +01:00
committed by GitHub
13 changed files with 172 additions and 152 deletions

View File

@@ -101,14 +101,16 @@
#-----| -> Crate(getopts@0.2.21)
#-----| -> Crate(libc@0.2.169)
#-----| Crate(test@0.0.1)
lib.rs:
# 0| Crate(test@0.0.1)
#-----| -> Crate(core@0.0.0)
#-----| -> Crate(std@0.0.0)
#-----| -> Crate(alloc@0.0.0)
#-----| -> Crate(proc_macro@0.0.0)
#-----| -> Crate(test@0.0.0)
#-----| Crate(main@0.0.1)
main.rs:
# 0| Crate(main@0.0.1)
#-----| -> Crate(core@0.0.0)
#-----| -> Crate(std@0.0.0)
#-----| -> Crate(alloc@0.0.0)

View File

@@ -6,6 +6,11 @@
import rust
query predicate nodes(Crate c) { any() }
class MyCrate extends Crate {
// avoid printing locations for crates outside of the test folder
Location getLocation() { result = super.getLocation() and this.fromSource() }
}
query predicate edges(Crate c1, Crate c2) { c1.getADependency() = c2 }
query predicate nodes(MyCrate c) { any() }
query predicate edges(MyCrate c1, MyCrate c2) { c1.getADependency() = c2 }