mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Rust: Remove unnecessary edges.
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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(...) |
|
||||
|
||||
Reference in New Issue
Block a user