mirror of
https://github.com/github/codeql.git
synced 2026-05-14 03:09:26 +02:00
Every rule firing returned `Vec<Id>` even though the overwhelming majority of rules produce a single replacement node. Switch the Transform return type, try_rule, apply_rules, and apply_rules_inner to `RuleOutput = SmallVec<[Id; 1]>`. Re-export `smallvec` and `SmallVec` from the yeast crate so generated rule! macro code can refer to them by short paths. For the rule! macro, generate `yeast::smallvec![__id]` for the shorthand form and `yeast::RuleOutput = yeast::SmallVec::new()` for the full template form, so rule outputs stay inline for the common single-Id case. Per-firing memory: a Vec allocation per rule firing turns into zero when the rule produces 0 or 1 Ids. Rules that produce multiple Ids still allocate (SmallVec spills to heap when the inline buffer is exceeded), unchanged from before.
CodeQL Shared Libraries
This folder contains shared, language-agnostic CodeQL libraries.
Libraries are organized into separate query packs, in order to allow for
individual versioning. For example, the shared static single assignment (SSA)
library exists in the codeql/ssa pack, which can be referenced by adding
dependencies:
codeql/ssa: 0.0.1
to qlpack.yml.
All shared libraries will belong to a codeql/<name> pack, and live in the
namespace codeql.<name>.