Rust: Remove unnecessary edges.

This commit is contained in:
Geoffrey White
2024-12-02 09:32:35 +00:00
parent 4d0c53d493
commit 3e0e374783
2 changed files with 5 additions and 6 deletions

View File

@@ -40,16 +40,17 @@ class StdCall extends Expr {
class PathElement = AstNode;
query predicate edges(PathElement pred, PathElement succ) {
// starting edge
// starting edge (`#[ctor]` / `#[dtor]` attribute to call)
exists(CtorAttr ctor, Function f, CallExprBase call |
f.getAnAttr() = ctor and
call.getEnclosingCallable() = f and
pred = ctor and // source
succ = call // flow or sink node
pred = ctor and
succ = call
)
or
// transitive edge
// transitive edge (call to call)
exists(Function f |
edges(_, pred) and
pred.(CallExprBase).getStaticTarget() = f and
succ.(CallExprBase).getEnclosingCallable() = f
)

View File

@@ -50,7 +50,5 @@ edges
| test.rs:147:5:147:20 | call_target3_1(...) | test.rs:126:9:126:16 | stderr(...) |
| test.rs:147:5:147:20 | call_target3_1(...) | test.rs:126:9:126:44 | ... .write_all(...) |
| test.rs:151:1:151:7 | Attr | test.rs:153:5:153:12 | bad3_3(...) |
| test.rs:157:5:157:20 | call_target3_1(...) | test.rs:126:9:126:16 | stderr(...) |
| test.rs:157:5:157:20 | call_target3_1(...) | test.rs:126:9:126:44 | ... .write_all(...) |
| test.rs:169:1:169:7 | Attr | test.rs:171:5:171:15 | ... .write(...) |
| test.rs:169:1:169:7 | Attr | test.rs:171:5:171:15 | ...::stdout(...) |