mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Generate ParamBase, superclass of Param and SelfParam
This commit is contained in:
2
rust/extractor/src/generated/.generated.list
generated
2
rust/extractor/src/generated/.generated.list
generated
@@ -1,2 +1,2 @@
|
||||
mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7
|
||||
top.rs 7a5bbe75eae6069f4f255db13787a3575e706742af1f57122c02d46895de9a1b 7a5bbe75eae6069f4f255db13787a3575e706742af1f57122c02d46895de9a1b
|
||||
top.rs 4504ceb7e13020d5b19a4b938395fa2d5d804a962743985efe8563903448ae0c 4504ceb7e13020d5b19a4b938395fa2d5d804a962743985efe8563903448ae0c
|
||||
|
||||
256
rust/extractor/src/generated/top.rs
generated
256
rust/extractor/src/generated/top.rs
generated
@@ -1501,57 +1501,35 @@ impl From<trap::Label<NameRef>> for trap::Label<Locatable> {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Param {
|
||||
pub id: trap::TrapId<Param>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub pat: Option<trap::Label<Pat>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
pub struct ParamBase {
|
||||
_unused: ()
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for Param {
|
||||
fn extract_id(&mut self) -> trap::TrapId<Self> {
|
||||
std::mem::replace(&mut self.id, trap::TrapId::Star)
|
||||
}
|
||||
|
||||
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("params", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("param_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.pat {
|
||||
out.add_tuple("param_pats", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.ty {
|
||||
out.add_tuple("param_ties", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
impl trap::TrapClass for ParamBase {
|
||||
fn class_name() -> &'static str { "ParamBase" }
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Param {
|
||||
fn class_name() -> &'static str { "Param" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Param>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<Param>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Param is a subclass of AstNode
|
||||
impl From<trap::Label<ParamBase>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<ParamBase>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme ParamBase is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Param>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<Param>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Param is a subclass of Element
|
||||
impl From<trap::Label<ParamBase>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<ParamBase>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme ParamBase is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Param>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<Param>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Param is a subclass of Locatable
|
||||
impl From<trap::Label<ParamBase>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<ParamBase>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme ParamBase is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
@@ -2203,72 +2181,6 @@ impl From<trap::Label<ReturnTypeSyntax>> for trap::Label<Locatable> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SelfParam {
|
||||
pub id: trap::TrapId<SelfParam>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub is_mut: bool,
|
||||
pub lifetime: Option<trap::Label<Lifetime>>,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for SelfParam {
|
||||
fn extract_id(&mut self) -> trap::TrapId<Self> {
|
||||
std::mem::replace(&mut self.id, trap::TrapId::Star)
|
||||
}
|
||||
|
||||
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("self_params", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("self_param_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if self.is_mut {
|
||||
out.add_tuple("self_param_is_mut", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.lifetime {
|
||||
out.add_tuple("self_param_lifetimes", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("self_param_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.ty {
|
||||
out.add_tuple("self_param_ties", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for SelfParam {
|
||||
fn class_name() -> &'static str { "SelfParam" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<SelfParam>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<SelfParam>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme SelfParam is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<SelfParam>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<SelfParam>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme SelfParam is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<SelfParam>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<SelfParam>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme SelfParam is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SourceFile {
|
||||
pub id: trap::TrapId<SourceFile>,
|
||||
@@ -5862,6 +5774,73 @@ impl From<trap::Label<OrPat>> for trap::Label<Pat> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Param {
|
||||
pub id: trap::TrapId<Param>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
pub pat: Option<trap::Label<Pat>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for Param {
|
||||
fn extract_id(&mut self) -> trap::TrapId<Self> {
|
||||
std::mem::replace(&mut self.id, trap::TrapId::Star)
|
||||
}
|
||||
|
||||
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("params", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("param_base_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.ty {
|
||||
out.add_tuple("param_base_ties", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.pat {
|
||||
out.add_tuple("param_pats", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Param {
|
||||
fn class_name() -> &'static str { "Param" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Param>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<Param>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Param is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Param>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<Param>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Param is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Param>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<Param>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Param is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Param>> for trap::Label<ParamBase> {
|
||||
fn from(value: trap::Label<Param>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Param is a subclass of ParamBase
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ParenExpr {
|
||||
pub id: trap::TrapId<ParenExpr>,
|
||||
@@ -7053,6 +7032,81 @@ impl From<trap::Label<ReturnExpr>> for trap::Label<Locatable> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SelfParam {
|
||||
pub id: trap::TrapId<SelfParam>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
pub is_mut: bool,
|
||||
pub lifetime: Option<trap::Label<Lifetime>>,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for SelfParam {
|
||||
fn extract_id(&mut self) -> trap::TrapId<Self> {
|
||||
std::mem::replace(&mut self.id, trap::TrapId::Star)
|
||||
}
|
||||
|
||||
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("self_params", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("param_base_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.ty {
|
||||
out.add_tuple("param_base_ties", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_mut {
|
||||
out.add_tuple("self_param_is_mut", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.lifetime {
|
||||
out.add_tuple("self_param_lifetimes", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("self_param_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for SelfParam {
|
||||
fn class_name() -> &'static str { "SelfParam" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<SelfParam>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<SelfParam>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme SelfParam is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<SelfParam>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<SelfParam>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme SelfParam is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<SelfParam>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<SelfParam>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme SelfParam is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<SelfParam>> for trap::Label<ParamBase> {
|
||||
fn from(value: trap::Label<SelfParam>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme SelfParam is a subclass of ParamBase
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SlicePat {
|
||||
pub id: trap::TrapId<SlicePat>,
|
||||
|
||||
27
rust/ql/.generated.list
generated
27
rust/ql/.generated.list
generated
@@ -1,4 +1,4 @@
|
||||
lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll 4005dd5213c45c8f96e12f08d8a6a7532692d68a3cd9e3a0fd55d7f982a92f23 ec753357ac4fc76706acc0cf1d9208e63a0688e480ece52e4314d7dc2a743de5
|
||||
lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll e1d6ad3a582c15addb042ce1e054a916f81030f7a10a69408ab929679e9a92ad f1837efe28fb1ae5162437a482d35d24a792e133e10879284202c45e90c62ff6
|
||||
lib/codeql/rust/elements/Abi.qll 4c973d28b6d628f5959d1f1cc793704572fd0acaae9a97dfce82ff9d73f73476 250f68350180af080f904cd34cb2af481c5c688dc93edf7365fd0ae99855e893
|
||||
lib/codeql/rust/elements/ArgList.qll 661f5100f5d3ef8351452d9058b663a2a5c720eea8cf11bedd628969741486a2 28e424aac01a90fb58cd6f9f83c7e4cf379eea39e636bc0ba07efc818be71c71
|
||||
lib/codeql/rust/elements/ArrayExpr.qll a3e6e122632f4011644ec31b37f88b32fe3f2b7e388e7e878a6883309937049f 12ccb5873d95c433da5606fd371d182ef2f71b78d0c53c2d6dec10fa45852bdc
|
||||
@@ -93,7 +93,8 @@ lib/codeql/rust/elements/NameRef.qll f11e33cdbefb3efdd8db6cd1eee593948a16ef5dd13
|
||||
lib/codeql/rust/elements/NeverType.qll 669823dd60bba0cebac614f9dbad9dc9228405d76e62092e265df57fdd2e04e2 8fe32975ef80d86fb8b218f56962f0a89911008a8d6989e245c3e0362f2c747f
|
||||
lib/codeql/rust/elements/OffsetOfExpr.qll 8f6dd1fe0aad1642e58f5e97620306e4b36cdf01324fead1e2a92e8e60951c41 b192f7a5fae3049a6cac3b7a225a0e590f744e6c5ff6346ffdd1699f83bf718f
|
||||
lib/codeql/rust/elements/OrPat.qll 408b71f51edbfc79bf93b86fb058d01fa79caf2ebfeef37b50ae1da886c71b68 4a3f2b00db33fe26ee0859e35261016312cb491e23c46746cdd6d8bb1f6c88ef
|
||||
lib/codeql/rust/elements/Param.qll 3108a710214977218421b220d1330793173d6b6b91708b641e3d1275f80faedb 4bb2b80d0a9a4d86f980440851d59ca6fffea681e5518f5d605c521191efd7b4
|
||||
lib/codeql/rust/elements/Param.qll d0c0a427c003bbbacaeb0c2f4566f35b997ad0bca4d49f97b50c3a4bd1ddbd71 e654a17dfcb7aaeb589e7944c38f591c4cf922ebceb834071bcb9f9165ee48be
|
||||
lib/codeql/rust/elements/ParamBase.qll ab8cb39ac313a5dce7d1a6dcd490c5033034d88f0e402f315f4236bb76c2c464 414afc1f34c1df28f76220c5d3255ae3d7629f3df8b870d0949f3a6c87e26d71
|
||||
lib/codeql/rust/elements/ParamList.qll 33a22ba7de565db4009d3f56eecd5ef809c28d9dce9bbac3fb71b528baae4f70 004375e227d87f76f930322ad3eac274f9b691bf58785ae69977fa319f3dba7e
|
||||
lib/codeql/rust/elements/ParenExpr.qll b635f0e5d300cd9cf3651cfcefd58316c21727295bbfd44b1f5672f9e3de67b6 d81c0034d4ea7ca5829f9b00e0a634ba5b557a6296d99f0b5344b11e1ba705a1
|
||||
lib/codeql/rust/elements/ParenPat.qll 40d033de6c85ad042223e0da80479adebab35494396ab652da85d3497e435c5a 8f2febe5d5cefcb076d201ae9607d403b9cfe8169d2f4b71d13868e0af43dc25
|
||||
@@ -126,7 +127,7 @@ lib/codeql/rust/elements/RestPat.qll a898a2c396f974a52424efbc8168174416ac6ed30f9
|
||||
lib/codeql/rust/elements/RetType.qll 36ea39240a56c504d94d5487ea9679563eef3dfe0e23bf42d992d1ab2b883518 2fe5b6f62a634c6aa30a1ecd620f3446c167669cf1285c8ef8dd5e5a6ef5fc71
|
||||
lib/codeql/rust/elements/ReturnExpr.qll b87187cff55bc33c8c18558c9b88617179183d1341b322c1cab35ba07167bbdb 892f3a9df2187e745c869e67f33c228ee42754bc9e4f8f4c1718472eb8f8c80f
|
||||
lib/codeql/rust/elements/ReturnTypeSyntax.qll 0aa9125f5ea8864ecf1e4ff6e85f060f1b11fdd603448816145fea1b290f0232 3911819548ad1cf493199aac2ed15652c8e48b532a1e92153388b062191c1e6e
|
||||
lib/codeql/rust/elements/SelfParam.qll 5c9629e1cd837f5d84bdd79a1aef9cca6fb0acb1fb18671d4a4d28c23a74551a 41eb92527cf4379a2df54a0c9fabc368cb6f9b8d1ac73bd2ab3f13214573e764
|
||||
lib/codeql/rust/elements/SelfParam.qll 7d720c99097a340bc7bf6cc27ac6fe291a04af53e9bac23bf070b04b36e6e033 736488794a46ea702dcd3f603134052598207f3953acce3c9237bd6c6a038b23
|
||||
lib/codeql/rust/elements/SlicePat.qll f48f13bb13378cc68f935d5b09175c316f3e81f50ef6a3ac5fdbfbfb473d6fc1 4c8df0b092274f37028e287a949f1a287f7505b7c2c36ee8d5f47fb8365d278a
|
||||
lib/codeql/rust/elements/SliceType.qll 7e49dba57826c7bb72a88f9e802febdb09adfc49804f6205dc88f2a307fd1f30 6c3ee430f812f1d9fbb1fb1fdd2c47130a4bde7fccf17f09404b8cbc8104678a
|
||||
lib/codeql/rust/elements/SourceFile.qll 5916d550385d618bd3b3d4835fbd3040485822220af8ce52ee1adb649b3d8594 0b79766216649e948fa59de467d64fa752de4666c28e0e503e88740ae27a2aef
|
||||
@@ -292,6 +293,7 @@ lib/codeql/rust/elements/internal/NeverTypeConstructor.qll 6a86bff9d885eddf39a15
|
||||
lib/codeql/rust/elements/internal/OffsetOfExprConstructor.qll 616e146562adb3ac0fba4d6f55dd6ce60518ed377c0856f1f09ba49593e7bfab 80518ce90fc6d08011d6f5fc2a543958067739e1b0a6a5f2ed90fc9b1db078f0
|
||||
lib/codeql/rust/elements/internal/OffsetOfExprImpl.qll e52d4596068cc54719438121f7d5afcaab04e0c70168ac5e4df1a3a0969817a6 6ab37e659d79e02fb2685d6802ae124157bf14b6f790b31688f437c87f40f52c
|
||||
lib/codeql/rust/elements/internal/OrPatConstructor.qll 4ef583e07298487c0c4c6d7c76ffcc04b1e5fe58aba0c1da3e2c8446a9e0c92b 980a6bd176ae5e5b11c134569910c5468ba91f480982d846e222d031a6a05f1a
|
||||
lib/codeql/rust/elements/internal/ParamBaseImpl.qll fe11999c728c443c46c992e9bed7a2b3e23afa16ae99592e70054bc57ae371b8 df86fdb23266bdfb9ed8a8f02558a760b67f173943b9d075b081229eb5844f66
|
||||
lib/codeql/rust/elements/internal/ParamConstructor.qll b98a2d8969f289fdcc8c0fb11cbd19a3b0c71be038c4a74f5988295a2bae52f0 77d81b31064167945b79b19d9697b57ca24462c3a7cc19e462c4693ce87db532
|
||||
lib/codeql/rust/elements/internal/ParamListConstructor.qll 3123142ab3cab46fb53d7f3eff6ba2d3ff7a45b78839a53dc1979a9c6a54920e 165f3d777ea257cfcf142cc4ba9a0ebcd1902eb99842b8a6657c87087f3df6fe
|
||||
lib/codeql/rust/elements/internal/ParamListImpl.qll 0ed6e9affe1dc0144641502292c2ddd51958fe3d503419caf15198176e3a4174 92d053cc5fdf40a2d98acb665083b5da15403d7da205779a97a4ee66fac0add4
|
||||
@@ -338,7 +340,7 @@ lib/codeql/rust/elements/internal/ReturnExprConstructor.qll 57be5afbe20aa8db6e63
|
||||
lib/codeql/rust/elements/internal/ReturnTypeSyntaxConstructor.qll 8994672e504d1674e5773157d0ad8a0dc3aad3d64ef295e7722e647e78e36c11 abe7df754721f4ff7f3e3bb22d275976b2e9a1ef51436a461fe52ebd2d29cff1
|
||||
lib/codeql/rust/elements/internal/ReturnTypeSyntaxImpl.qll d47a3dcfcc2b02a6a9eaeefe9a7a4be2074ecd2019da129dda0f218bc3fbd94b 87198db7c0620ed49369da160f09287015e0cd1718784e1ba28ec3ec5a0bb4a8
|
||||
lib/codeql/rust/elements/internal/SelfParamConstructor.qll a63af1d1ccde6013c09e0397f1247f5ab3efd97f3410dd1b6c15e1fb6cd96e54 0d8977653c074d5010c78144327f8b6c4da07f09d21e5cc3342082cd50107a81
|
||||
lib/codeql/rust/elements/internal/SelfParamImpl.qll 5408738c40f070e0cea83a6a38d638ac7a134b5a055ecf0cccc035af58ff9b36 604922319ecf9a9405fdd0fe953169162ee2c8cca36349b49163a2895c53ed40
|
||||
lib/codeql/rust/elements/internal/SelfParamImpl.qll def23beb8926f498fc81b7b44489001b35d704da1a2058c84c23b329e8bc2f49 c9be1e8fa2c4e23b314a4d0563be6cffcbab6f03d08b77a366f7638b28a09de4
|
||||
lib/codeql/rust/elements/internal/SlicePatConstructor.qll 19216ec9e87ca98784d78b29b8b06ea9ac428e2faa468f0717d1c0d0a8e7351c 458e5be76aa51aec579566be39486525ec9d4c73d248cb228da74892e2a56c08
|
||||
lib/codeql/rust/elements/internal/SlicePatImpl.qll c6176095360e3b23382557242d2d3ff0b5e0f01f8b1c438452518e9c36ff3c70 644ab41a59a619947f69f75e2d0807245d4ddefc247efaeab63b99b4f08c1cc1
|
||||
lib/codeql/rust/elements/internal/SliceTypeConstructor.qll 643e7a2ae261e8f62de8bc2886efddcc096e0c7e8159c0b9e87b24d0509e10d0 719545abb0ccf6e8a203ec9c9f75109c5ab0593c838e2f90e388858680ec62f7
|
||||
@@ -504,12 +506,13 @@ lib/codeql/rust/elements/internal/generated/NameRef.qll 4292fc7aa9ba22a7fa5bd638
|
||||
lib/codeql/rust/elements/internal/generated/NeverType.qll 14dd3c08db1db873b365fc7f0d1cf3f5d6229b1f78bc85100c36c22d1bb8ee40 34257df0ac59cfd982ea5f30ab225c8bfece71d9fd3be84ff79cf1b0bff55060
|
||||
lib/codeql/rust/elements/internal/generated/OffsetOfExpr.qll bb17a1e1d4332225cf4bbbae4a1bab9302c2d81d191fe835f2f973915d40dd2a f9e73210b81992040a5a5a9ac3ad936159fb3475445f130c7b28f83dfb4170f5
|
||||
lib/codeql/rust/elements/internal/generated/OrPat.qll ee0487b90849c3e2a836c956ae8837f27515a9dc795bf17287cba2cf7a39d839 35117b6a3dcebab09f12665441332b6863200e206679ee97894170dd9ef7795c
|
||||
lib/codeql/rust/elements/internal/generated/Param.qll c57bf238123e8337adb1556cf788bde2b2e8841d4afa0799649db9d507b02d85 7cb580219ec9b6257735f7c53260cd2bb5533dbe342bef3b793ec7b6a65e7027
|
||||
lib/codeql/rust/elements/internal/generated/Param.qll 4f853cece9ca8d41ef41ff7656a7f291568f1218403bebcd8afbf07e93fab6bf 93a1372f1d129b83470aa0dc481f46649771d1f5b72b114f215a51514ddd641a
|
||||
lib/codeql/rust/elements/internal/generated/ParamBase.qll 9d9a82643019d2a13f28555dbdd60221cf6dc2e890f6541e7f85a91646585f2c 0e4a3e4c0e069a43d449167cb706c6f5d0d097b4cab2a7ade84c2c1b5528eca7
|
||||
lib/codeql/rust/elements/internal/generated/ParamList.qll c808c9d84dd7800573832b63a2ca5296b5506bffdeea054893a56cde08f91560 d4599c52231f93e1260fbae7de8891fe4287fa68b1423592b7a1d51c80146dc8
|
||||
lib/codeql/rust/elements/internal/generated/ParenExpr.qll bc0731505bfe88516205ec360582a4222d2681d11342c93e15258590ddee82f2 d4bd6e0c80cf1d63746c88d4bcb3a01d4c75732e5da09e3ebd9437ced227fb60
|
||||
lib/codeql/rust/elements/internal/generated/ParenPat.qll ce24b8f8ecbf0f204af200317405724063887257460c80cf250c39b2fdf37185 e7c87d37e1a0ca7ea03840017e1aa9ddb7f927f1f3b6396c0305b46aeee33db6
|
||||
lib/codeql/rust/elements/internal/generated/ParenType.qll 9cc954d73f8330dcac7b475f97748b63af5c8766dee9d2f2872c0a7e4c903537 c07534c8a9c683c4a9b11d490095647e420de0a0bfc23273eaf6f31b00244273
|
||||
lib/codeql/rust/elements/internal/generated/ParentChild.qll 52186ab2aead10bbbaab401272afff0b8247b0050064123d0e45d972ec501dee f082318c0da678845763d6070283872b94b59425fbaa305582b5fe72da03e7e6
|
||||
lib/codeql/rust/elements/internal/generated/ParentChild.qll ae0288399423b8b69a98a520ff4d2cb53d15ec404696cf62b0ceea965e2258ba aed73c416d74b504c02ee2e9bc2a72881d851ad0819b331b59728a4084e14fdd
|
||||
lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4
|
||||
lib/codeql/rust/elements/internal/generated/Path.qll 4c1c8e840ed57880e574142b081b11d7a7428a009f10e3aa8f4645e211f6b2e0 989668cf0f1bdee7557e2f97c01e41d2a56848227fed41477833f5fc1e1d35f6
|
||||
lib/codeql/rust/elements/internal/generated/PathExpr.qll 2096e3c1db22ee488a761690adabfc9cfdea501c99f7c5d96c0019cb113fc506 54245ce0449c4e263173213df01e079d5168a758503a5dbd61b25ad35a311140
|
||||
@@ -522,7 +525,7 @@ lib/codeql/rust/elements/internal/generated/PtrType.qll 40099c5a4041314b66932dfd
|
||||
lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll ea294a3ba33fd1bc632046c4fedbcb84dcb961a8e4599969d65893b19d90e590 ea294a3ba33fd1bc632046c4fedbcb84dcb961a8e4599969d65893b19d90e590
|
||||
lib/codeql/rust/elements/internal/generated/RangeExpr.qll 23cca03bf43535f33b22a38894f70d669787be4e4f5b8fe5c8f7b964d30e9027 18624cef6c6b679eeace2a98737e472432e0ead354cca02192b4d45330f047c9
|
||||
lib/codeql/rust/elements/internal/generated/RangePat.qll efd93730de217cf50dcba5875595263a5eadf9f7e4e1272401342a094d158614 229b251b3d118932e31e78ac4dfb75f48b766f240f20d436062785606d44467b
|
||||
lib/codeql/rust/elements/internal/generated/Raw.qll b23d3574920376ca7c52858d6ad2ea6670640812422329f9c44f699075c16d89 13c1a199de3e71f012bdab0fa2b982f1c92f95536b07bbbe816e680a0e64ad71
|
||||
lib/codeql/rust/elements/internal/generated/Raw.qll ee5642a7a5ad75f48d4db10eccb197b1a11db2fc3432cf2e24a8bcbe83a474e2 134f2e0c87039d052dd31991017fb35597f37f28879abd702b62ec1d880118c6
|
||||
lib/codeql/rust/elements/internal/generated/RecordExpr.qll eb6cb662e463f9260efae1a6ce874fa781172063b916ef1963f861e9942d308d 1a21cbccc8f3799ff13281e822818ebfb21d81591720a427cac3625512cb9d40
|
||||
lib/codeql/rust/elements/internal/generated/RecordExprField.qll 7e9f8663d3b74ebbc9603b10c9912f082febba6bd73d344b100bbd3edf837802 fbe6b578e7fd5d5a6f21bbb8c388957ab7210a6a249ec71510a50fb35b319ea1
|
||||
lib/codeql/rust/elements/internal/generated/RecordExprFieldList.qll 179a97211fe7aa6265085d4d54115cdbc0e1cd7c9b2135591e8f36d6432f13d3 dd44bbbc1e83a1ed3a587afb729d7debf7aeb7b63245de181726af13090e50c0
|
||||
@@ -540,7 +543,7 @@ lib/codeql/rust/elements/internal/generated/RestPat.qll b3a4206e68cf67a0310a4667
|
||||
lib/codeql/rust/elements/internal/generated/RetType.qll a26860cd526b339b9527c089d126c5486e678dd080e88c60ea2fe641e7d661fd a83c1ce32fd043945ad455b892a60c2a9b6a62d7a5aadf121c4b4056d1dfb094
|
||||
lib/codeql/rust/elements/internal/generated/ReturnExpr.qll c9c05400d326cd8e0da11c3bfa524daa08b2579ecaee80e468076e5dd7911d56 e7694926727220f46a7617b6ca336767450e359c6fa3782e82b1e21d85d37268
|
||||
lib/codeql/rust/elements/internal/generated/ReturnTypeSyntax.qll 34e32623d2c0e848c57ce1892c16f4bc81ccca7df22dc21dad5eb48969224465 ccb07c205468bce06392ff4a150136c0d8ebacfb15d1d96dd599ab020b353f47
|
||||
lib/codeql/rust/elements/internal/generated/SelfParam.qll cf6837c2731b45632f04092079d295eee3e02d19f73c73b3ccbce1abe12203bf 87eaa9d982506904c42030f7173dd01fd52f3edd9d2c8d19b572f6d5454f769b
|
||||
lib/codeql/rust/elements/internal/generated/SelfParam.qll e1d994dea58a406dbfca3ea0c724ac48be66ac4380e7270e4037ca2714eef722 90f8ebfac723eef259e13d3c8a7ef6b886c2831d4f436a742144b96db6b6fc92
|
||||
lib/codeql/rust/elements/internal/generated/SlicePat.qll 8b1463758d7b15a0303384c8136a48a8e71ce27da4ba6e421272b9751a988e64 7562d47308f197bc63ade0f114cd23a17e7f60fa696716f6a30fc7b7411642fe
|
||||
lib/codeql/rust/elements/internal/generated/SliceType.qll 98ee8b566be28f392ab9c9507600e8461ad0b48cbbbd422d22548aca691f8330 528d6eabddf49b9dc474971a2f3a6ddb6f2d77dc7f8449140ef54646c1ceb822
|
||||
lib/codeql/rust/elements/internal/generated/SourceFile.qll 55d44c9f09c5ff28c4f715f779a0db74083e1180acaf0d410e63ca07b90d1cb5 78c0af48b0b64aa377413ea4799dfe977602a111208e1d25e4bdfa920dbd7238
|
||||
@@ -548,7 +551,7 @@ lib/codeql/rust/elements/internal/generated/Static.qll 5fbd6879858cf356d4bdaa6da
|
||||
lib/codeql/rust/elements/internal/generated/Stmt.qll 8473ff532dd5cc9d7decaddcd174b94d610f6ca0aec8e473cc051dad9f3db917 6ef7d2b5237c2dbdcacbf7d8b39109d4dc100229f2b28b5c9e3e4fbf673ba72b
|
||||
lib/codeql/rust/elements/internal/generated/StmtList.qll a667193e32341e17400867c6e359878c4e645ef9f5f4d97676afc0283a33a026 a320ed678ee359302e2fc1b70a9476705cd616fcfa44a499d32f0c7715627f73
|
||||
lib/codeql/rust/elements/internal/generated/Struct.qll 4d57f0db12dc7ad3e31e750a24172ef1505406b4dab16386af0674bd18bf8f4b 1a73c83df926b996f629316f74c61ea775be04532ab61b56af904223354f033e
|
||||
lib/codeql/rust/elements/internal/generated/Synth.qll 0e5767568fd119df13928adf00950586f5f9f355dae520059b2d6daa7a2bda56 219b40f6458fec2cc436dc2cf80bb1dbfb34dfdbe8576606b5e25f78d36d6210
|
||||
lib/codeql/rust/elements/internal/generated/Synth.qll db8ffbd55def03f0b0278cafa60274220eb571257da36e185f380e3c5b2caedf 19074971c3e96a43414738976c9625385c4bbac6b01c7eca2f46432034a279b7
|
||||
lib/codeql/rust/elements/internal/generated/SynthConstructors.qll e929c49ea60810a2bbc19ad38110b8bbaf21db54dae90393b21a3459a54abf6f e929c49ea60810a2bbc19ad38110b8bbaf21db54dae90393b21a3459a54abf6f
|
||||
lib/codeql/rust/elements/internal/generated/Token.qll 77a91a25ca5669703cf3a4353b591cef4d72caa6b0b9db07bb9e005d69c848d1 2fdffc4882ed3a6ca9ac6d1fb5f1ac5a471ca703e2ffdc642885fa558d6e373b
|
||||
lib/codeql/rust/elements/internal/generated/TokenTree.qll 8577c2b097c1be2f0f7daa5acfcf146f78674a424d99563e08a84dd3e6d91b46 d2f30764e84dbfc0a6a5d3d8a5f935cd432413688cb32da9c94e420fbc10665c
|
||||
@@ -583,7 +586,7 @@ lib/codeql/rust/elements/internal/generated/WhileExpr.qll 7edf1f23fbf953a2baabcd
|
||||
lib/codeql/rust/elements/internal/generated/WildcardPat.qll d74b70b57a0a66bfae017a329352a5b27a6b9e73dd5521d627f680e810c6c59e 4b913b548ba27ff3c82fcd32cf996ff329cb57d176d3bebd0fcef394486ea499
|
||||
lib/codeql/rust/elements/internal/generated/YeetExpr.qll cac328200872a35337b4bcb15c851afb4743f82c080f9738d295571eb01d7392 94af734eea08129b587fed849b643e7572800e8330c0b57d727d41abda47930b
|
||||
lib/codeql/rust/elements/internal/generated/YieldExpr.qll 37e5f0c1e373a22bbc53d8b7f2c0e1f476e5be5080b8437c5e964f4e83fad79a 4a9a68643401637bf48e5c2b2f74a6bf0ddcb4ff76f6bffb61d436b685621e85
|
||||
lib/codeql/rust/elements.qll 76fe494d20d2665777bcb5c5ced016a262789a0e6aa874c1a77ce4cb134422b6 76fe494d20d2665777bcb5c5ced016a262789a0e6aa874c1a77ce4cb134422b6
|
||||
lib/codeql/rust/elements.qll 83bda9f3bc481aaecc039db9cecb628495e15e469cc843336ca089f0d707f8d6 83bda9f3bc481aaecc039db9cecb628495e15e469cc843336ca089f0d707f8d6
|
||||
test/extractor-tests/generated/Abi/Abi.ql 7f6e7dc4af86eca3ebdc79b10373988cd0871bd78b51997d3cffd969105e5fdd 2f936b6ca005c6157c755121584410c03e4a3949c23bee302fbe05ee10ce118f
|
||||
test/extractor-tests/generated/Abi/Abi_getAbiString.ql a496762fcec5a0887b87023bbf93e9b650f02e20113e25c44d6e4281ae8f5335 14109c7ce11ba25e3cd6e7f1b3fcb4cb00622f2a4eac91bfe43145c5f366bc52
|
||||
test/extractor-tests/generated/ArgList/ArgList.ql e412927756e72165d0e7c5c9bd3fca89d08197bbf760db8fb7683c64bb2229bc 043dba8506946fbb87753e22c387987d7eded6ddb963aa067f9e60ef9024d684
|
||||
@@ -878,7 +881,7 @@ test/extractor-tests/generated/OffsetOfExpr/OffsetOfExpr_getField.ql 6d729fb91de
|
||||
test/extractor-tests/generated/OffsetOfExpr/OffsetOfExpr_getTy.ql b8597637cffd7a492148020b306c4ab1d2f17f919f441f462ebc00d229b038ca 2c7de1df4351929c221b30e3cede4cd6981fe8a2c1861e194489981c65e00f33
|
||||
test/extractor-tests/generated/OrPat/OrPat.ql 49d881b384acaf68fa79de46da997cacab3e75467641f61150908f4112c47fa4 5d721da23be44e79d7b8a0dd475119836828d6a1edaff2c55decea8da83e65b8
|
||||
test/extractor-tests/generated/OrPat/OrPat_getPat.ql d56b78287cecebacb25249380647500387e0d9e28be20034b8a12406a999a7c4 cba7bb60afaaed4333ea5ff6d3850fb44a8b42edee67d86fd16df85938454269
|
||||
test/extractor-tests/generated/Param/Param.ql 060c53b7e93840ae9cbf0c8fdaea17b16d6825f4b7aaa2eab164a660c5a7ea4d 172f6f4b86a98720f710e5d4342b7d52839c6f3c169ce1debb37629961a702ba
|
||||
test/extractor-tests/generated/Param/Param.ql ab8d0f8cc3c71f5d24be4aebde1ef7d016519490a9715aca6069e58fd11aeb1c 61197a0c2b8d6f0c5a9cddda39585dcd413644cf80e3ea28b037385142100b27
|
||||
test/extractor-tests/generated/Param/Param_getAttr.ql e1dcf86540fd2971ced34a33b2959f001c3f654914d82e576caa4534b80fbfbf 987a826bf6dcd25c3426edb603a22f6caa030c82c1cb0e9e11062fdbfed23030
|
||||
test/extractor-tests/generated/Param/Param_getPat.ql 0c448e8ba8bf3432be08b5eb4a052aa19cccf0eb4596a3239481401dae9d2dc2 c943d4da36e1e734c1a012f092b2f597cb389a7ab33d5371ff8ee9c93e115ffc
|
||||
test/extractor-tests/generated/Param/Param_getTy.ql 134dec0c5562a8df68224069f10ee51c7dcc35e0b44a49c0e2078c305487db87 94fa72a213c37f2f63f03789a33e55fc5a22bd83cf0c1d293281bceffb63bd78
|
||||
@@ -973,7 +976,7 @@ test/extractor-tests/generated/ReturnExpr/ReturnExpr.ql 8e9eba0837a466255e8e249e
|
||||
test/extractor-tests/generated/ReturnExpr/ReturnExpr_getAttr.ql 9fb7e1c79798e4f42e18785f3af17ea75f901a36abf9beb47a1eede69c613ba9 9cdb7cc4a4742865f6c92357973f84cee9229f55ff28081e5d17b6d57d6d275f
|
||||
test/extractor-tests/generated/ReturnExpr/ReturnExpr_getExpr.ql 7d4562efb0d26d92d11f03a0ef80338eb7d5a0c073f1f09cbb8a826f0cef33de 523ebd51b97f957afaf497e5a4d27929eed18e1d276054e3d5a7c5cfe7285c6e
|
||||
test/extractor-tests/generated/ReturnTypeSyntax/ReturnTypeSyntax.ql 976ce33fe3fd34aae2028a11b4accdee122b6d82d07722488c3239f0d2c14609 906bf8c8e7769a1052196bc78947b655158dd3b2903fef2802e2031cffbc1d78
|
||||
test/extractor-tests/generated/SelfParam/SelfParam.ql d051c7a2dd88382e37895f1d691f2702aed7f925d3936f51d49949463e4757c8 37f1f429093be7923a55f8b4f46b37bbf71d0dff3843c4d3686383c2863dee1a
|
||||
test/extractor-tests/generated/SelfParam/SelfParam.ql 12ad3244a2700e13a84603d6992f0c872572bca68d25515a7a9414b3c96a62e0 70028e344bc4ab2937f391f1fd8afd1549935aa621ce2cb9944da6a1dcf4be27
|
||||
test/extractor-tests/generated/SelfParam/SelfParam_getAttr.ql 00dd5409c07e9a7b5dc51c1444e24b35d2ac3cab11320396ef70f531a3b65dc0 effbed79ad530a835e85b931389a0c8609a10ee035cb694f2e39b8539f8e54ba
|
||||
test/extractor-tests/generated/SelfParam/SelfParam_getLifetime.ql 0b7c243f609e005dd63fd1b3b9f0096fc13cb98fe113e6f3fefb0d5c414e9a5f f6e06de8bcddfc9bd978c058079e53174edbe7b39f18df3c0bd4e80486808eda
|
||||
test/extractor-tests/generated/SelfParam/SelfParam_getName.ql 69207a57b415ba590e50003d506a64fd1780b27b8832b14f9bd3c909bddb5593 56fa28ba1222f45893237052fa5a9421d960e14fbf1396b2d1049b440c2e5abe
|
||||
|
||||
3
rust/ql/.gitattributes
generated
vendored
3
rust/ql/.gitattributes
generated
vendored
@@ -96,6 +96,7 @@
|
||||
/lib/codeql/rust/elements/OffsetOfExpr.qll linguist-generated
|
||||
/lib/codeql/rust/elements/OrPat.qll linguist-generated
|
||||
/lib/codeql/rust/elements/Param.qll linguist-generated
|
||||
/lib/codeql/rust/elements/ParamBase.qll linguist-generated
|
||||
/lib/codeql/rust/elements/ParamList.qll linguist-generated
|
||||
/lib/codeql/rust/elements/ParenExpr.qll linguist-generated
|
||||
/lib/codeql/rust/elements/ParenPat.qll linguist-generated
|
||||
@@ -294,6 +295,7 @@
|
||||
/lib/codeql/rust/elements/internal/OffsetOfExprConstructor.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/OffsetOfExprImpl.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/OrPatConstructor.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/ParamBaseImpl.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/ParamConstructor.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/ParamListConstructor.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/ParamListImpl.qll linguist-generated
|
||||
@@ -507,6 +509,7 @@
|
||||
/lib/codeql/rust/elements/internal/generated/OffsetOfExpr.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/OrPat.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/Param.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/ParamBase.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/ParamList.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/ParenExpr.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/ParenPat.qll linguist-generated
|
||||
|
||||
@@ -1940,12 +1940,14 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
|
||||
}
|
||||
|
||||
/**
|
||||
* A Param. For example:
|
||||
* A parameter in a function or method. For example `x` in:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* fn new(x: T) -> Foo<T> {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
final class ParamCfgNode extends CfgNodeFinal {
|
||||
final class ParamCfgNode extends CfgNodeFinal, ParamBaseCfgNode {
|
||||
private Param node;
|
||||
|
||||
ParamCfgNode() { node = this.getAstNode() }
|
||||
@@ -1953,21 +1955,6 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
|
||||
/** Gets the underlying `Param`. */
|
||||
Param getParam() { result = node }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this parameter (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { result = node.getAttr(index) }
|
||||
|
||||
/**
|
||||
* Gets any of the attrs of this parameter.
|
||||
*/
|
||||
Attr getAnAttr() { result = this.getAttr(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of attrs of this parameter.
|
||||
*/
|
||||
int getNumberOfAttrs() { result = count(int i | exists(this.getAttr(i))) }
|
||||
|
||||
/**
|
||||
* Gets the pat of this parameter, if it exists.
|
||||
*/
|
||||
@@ -1979,9 +1966,40 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
|
||||
* Holds if `getPat()` exists.
|
||||
*/
|
||||
predicate hasPat() { exists(this.getPat()) }
|
||||
}
|
||||
|
||||
final private class ParentParamBase extends ParentAstNode, ParamBase {
|
||||
override predicate relevantChild(AstNode child) { none() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A normal parameter, `Param`, or a self parameter `SelfParam`.
|
||||
*/
|
||||
final class ParamBaseCfgNode extends CfgNodeFinal {
|
||||
private ParamBase node;
|
||||
|
||||
ParamBaseCfgNode() { node = this.getAstNode() }
|
||||
|
||||
/** Gets the underlying `ParamBase`. */
|
||||
ParamBase getParamBase() { result = node }
|
||||
|
||||
/**
|
||||
* Gets the ty of this parameter, if it exists.
|
||||
* Gets the `index`th attr of this parameter base (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { result = node.getAttr(index) }
|
||||
|
||||
/**
|
||||
* Gets any of the attrs of this parameter base.
|
||||
*/
|
||||
Attr getAnAttr() { result = this.getAttr(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of attrs of this parameter base.
|
||||
*/
|
||||
int getNumberOfAttrs() { result = count(int i | exists(this.getAttr(i))) }
|
||||
|
||||
/**
|
||||
* Gets the ty of this parameter base, if it exists.
|
||||
*/
|
||||
TypeRef getTy() { result = node.getTy() }
|
||||
|
||||
@@ -2597,12 +2615,14 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
|
||||
}
|
||||
|
||||
/**
|
||||
* A SelfParam. For example:
|
||||
* A `self` parameter. For example `self` in:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* fn push(&mut self, value: T) {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
final class SelfParamCfgNode extends CfgNodeFinal {
|
||||
final class SelfParamCfgNode extends CfgNodeFinal, ParamBaseCfgNode {
|
||||
private SelfParam node;
|
||||
|
||||
SelfParamCfgNode() { node = this.getAstNode() }
|
||||
@@ -2610,21 +2630,6 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
|
||||
/** Gets the underlying `SelfParam`. */
|
||||
SelfParam getSelfParam() { result = node }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this self parameter (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { result = node.getAttr(index) }
|
||||
|
||||
/**
|
||||
* Gets any of the attrs of this self parameter.
|
||||
*/
|
||||
Attr getAnAttr() { result = this.getAttr(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of attrs of this self parameter.
|
||||
*/
|
||||
int getNumberOfAttrs() { result = count(int i | exists(this.getAttr(i))) }
|
||||
|
||||
/**
|
||||
* Holds if this self parameter is mut.
|
||||
*/
|
||||
@@ -2649,16 +2654,6 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
|
||||
* Holds if `getName()` exists.
|
||||
*/
|
||||
predicate hasName() { exists(this.getName()) }
|
||||
|
||||
/**
|
||||
* Gets the ty of this self parameter, if it exists.
|
||||
*/
|
||||
TypeRef getTy() { result = node.getTy() }
|
||||
|
||||
/**
|
||||
* Holds if `getTy()` exists.
|
||||
*/
|
||||
predicate hasTy() { exists(this.getTy()) }
|
||||
}
|
||||
|
||||
final private class ParentSlicePat extends ParentAstNode, SlicePat {
|
||||
|
||||
1
rust/ql/lib/codeql/rust/elements.qll
generated
1
rust/ql/lib/codeql/rust/elements.qll
generated
@@ -98,6 +98,7 @@ import codeql.rust.elements.NeverType
|
||||
import codeql.rust.elements.OffsetOfExpr
|
||||
import codeql.rust.elements.OrPat
|
||||
import codeql.rust.elements.Param
|
||||
import codeql.rust.elements.ParamBase
|
||||
import codeql.rust.elements.ParamList
|
||||
import codeql.rust.elements.ParenExpr
|
||||
import codeql.rust.elements.ParenPat
|
||||
|
||||
10
rust/ql/lib/codeql/rust/elements/Param.qll
generated
10
rust/ql/lib/codeql/rust/elements/Param.qll
generated
@@ -4,15 +4,15 @@
|
||||
*/
|
||||
|
||||
private import internal.ParamImpl
|
||||
import codeql.rust.elements.AstNode
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.ParamBase
|
||||
import codeql.rust.elements.Pat
|
||||
import codeql.rust.elements.TypeRef
|
||||
|
||||
/**
|
||||
* A Param. For example:
|
||||
* A parameter in a function or method. For example `x` in:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* fn new(x: T) -> Foo<T> {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
final class Param = Impl::Param;
|
||||
|
||||
14
rust/ql/lib/codeql/rust/elements/ParamBase.qll
generated
Normal file
14
rust/ql/lib/codeql/rust/elements/ParamBase.qll
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
// generated by codegen, do not edit
|
||||
/**
|
||||
* This module provides the public class `ParamBase`.
|
||||
*/
|
||||
|
||||
private import internal.ParamBaseImpl
|
||||
import codeql.rust.elements.AstNode
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.TypeRef
|
||||
|
||||
/**
|
||||
* A normal parameter, `Param`, or a self parameter `SelfParam`.
|
||||
*/
|
||||
final class ParamBase = Impl::ParamBase;
|
||||
10
rust/ql/lib/codeql/rust/elements/SelfParam.qll
generated
10
rust/ql/lib/codeql/rust/elements/SelfParam.qll
generated
@@ -4,16 +4,16 @@
|
||||
*/
|
||||
|
||||
private import internal.SelfParamImpl
|
||||
import codeql.rust.elements.AstNode
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.Lifetime
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.TypeRef
|
||||
import codeql.rust.elements.ParamBase
|
||||
|
||||
/**
|
||||
* A SelfParam. For example:
|
||||
* A `self` parameter. For example `self` in:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* fn push(&mut self, value: T) {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
final class SelfParam = Impl::SelfParam;
|
||||
|
||||
19
rust/ql/lib/codeql/rust/elements/internal/ParamBaseImpl.qll
generated
Normal file
19
rust/ql/lib/codeql/rust/elements/internal/ParamBaseImpl.qll
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
// generated by codegen, remove this comment if you wish to edit this file
|
||||
/**
|
||||
* This module provides a hand-modifiable wrapper around the generated class `ParamBase`.
|
||||
*
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
private import codeql.rust.elements.internal.generated.ParamBase
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the customizable definition of `ParamBase` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Impl {
|
||||
/**
|
||||
* A normal parameter, `Param`, or a self parameter `SelfParam`.
|
||||
*/
|
||||
class ParamBase extends Generated::ParamBase { }
|
||||
}
|
||||
@@ -13,9 +13,11 @@ private import codeql.rust.elements.internal.generated.Param
|
||||
module Impl {
|
||||
// the following QLdoc is generated: if you need to edit it, do it in the schema file
|
||||
/**
|
||||
* A Param. For example:
|
||||
* A parameter in a function or method. For example `x` in:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* fn new(x: T) -> Foo<T> {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Param extends Generated::Param {
|
||||
|
||||
@@ -13,9 +13,11 @@ private import codeql.rust.elements.internal.generated.SelfParam
|
||||
*/
|
||||
module Impl {
|
||||
/**
|
||||
* A SelfParam. For example:
|
||||
* A `self` parameter. For example `self` in:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* fn push(&mut self, value: T) {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class SelfParam extends Generated::SelfParam { }
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
|
||||
private import codeql.rust.elements.internal.generated.Synth
|
||||
private import codeql.rust.elements.internal.generated.Raw
|
||||
import codeql.rust.elements.internal.AstNodeImpl::Impl as AstNodeImpl
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.internal.ParamBaseImpl::Impl as ParamBaseImpl
|
||||
import codeql.rust.elements.Pat
|
||||
import codeql.rust.elements.TypeRef
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `Param` and should not
|
||||
@@ -17,33 +15,18 @@ import codeql.rust.elements.TypeRef
|
||||
*/
|
||||
module Generated {
|
||||
/**
|
||||
* A Param. For example:
|
||||
* A parameter in a function or method. For example `x` in:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* fn new(x: T) -> Foo<T> {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
* INTERNAL: Do not reference the `Generated::Param` class directly.
|
||||
* Use the subclass `Param`, where the following predicates are available.
|
||||
*/
|
||||
class Param extends Synth::TParam, AstNodeImpl::AstNode {
|
||||
class Param extends Synth::TParam, ParamBaseImpl::ParamBase {
|
||||
override string getAPrimaryQlClass() { result = "Param" }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this parameter (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) {
|
||||
result = Synth::convertAttrFromRaw(Synth::convertParamToRaw(this).(Raw::Param).getAttr(index))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets any of the attrs of this parameter.
|
||||
*/
|
||||
final Attr getAnAttr() { result = this.getAttr(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of attrs of this parameter.
|
||||
*/
|
||||
final int getNumberOfAttrs() { result = count(int i | exists(this.getAttr(i))) }
|
||||
|
||||
/**
|
||||
* Gets the pat of this parameter, if it exists.
|
||||
*/
|
||||
@@ -55,17 +38,5 @@ module Generated {
|
||||
* Holds if `getPat()` exists.
|
||||
*/
|
||||
final predicate hasPat() { exists(this.getPat()) }
|
||||
|
||||
/**
|
||||
* Gets the ty of this parameter, if it exists.
|
||||
*/
|
||||
TypeRef getTy() {
|
||||
result = Synth::convertTypeRefFromRaw(Synth::convertParamToRaw(this).(Raw::Param).getTy())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `getTy()` exists.
|
||||
*/
|
||||
final predicate hasTy() { exists(this.getTy()) }
|
||||
}
|
||||
}
|
||||
|
||||
55
rust/ql/lib/codeql/rust/elements/internal/generated/ParamBase.qll
generated
Normal file
55
rust/ql/lib/codeql/rust/elements/internal/generated/ParamBase.qll
generated
Normal file
@@ -0,0 +1,55 @@
|
||||
// generated by codegen, do not edit
|
||||
/**
|
||||
* This module provides the generated definition of `ParamBase`.
|
||||
* INTERNAL: Do not import directly.
|
||||
*/
|
||||
|
||||
private import codeql.rust.elements.internal.generated.Synth
|
||||
private import codeql.rust.elements.internal.generated.Raw
|
||||
import codeql.rust.elements.internal.AstNodeImpl::Impl as AstNodeImpl
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.TypeRef
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `ParamBase` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Generated {
|
||||
/**
|
||||
* A normal parameter, `Param`, or a self parameter `SelfParam`.
|
||||
* INTERNAL: Do not reference the `Generated::ParamBase` class directly.
|
||||
* Use the subclass `ParamBase`, where the following predicates are available.
|
||||
*/
|
||||
class ParamBase extends Synth::TParamBase, AstNodeImpl::AstNode {
|
||||
/**
|
||||
* Gets the `index`th attr of this parameter base (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) {
|
||||
result =
|
||||
Synth::convertAttrFromRaw(Synth::convertParamBaseToRaw(this).(Raw::ParamBase).getAttr(index))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets any of the attrs of this parameter base.
|
||||
*/
|
||||
final Attr getAnAttr() { result = this.getAttr(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of attrs of this parameter base.
|
||||
*/
|
||||
final int getNumberOfAttrs() { result = count(int i | exists(this.getAttr(i))) }
|
||||
|
||||
/**
|
||||
* Gets the ty of this parameter base, if it exists.
|
||||
*/
|
||||
TypeRef getTy() {
|
||||
result =
|
||||
Synth::convertTypeRefFromRaw(Synth::convertParamBaseToRaw(this).(Raw::ParamBase).getTy())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `getTy()` exists.
|
||||
*/
|
||||
final predicate hasTy() { exists(this.getTy()) }
|
||||
}
|
||||
}
|
||||
@@ -602,14 +602,13 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfParam(Param e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bAstNode, int n, int nAttr, int nPat, int nTy |
|
||||
private Element getImmediateChildOfParamBase(ParamBase e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bAstNode, int n, int nAttr, int nTy |
|
||||
b = 0 and
|
||||
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
|
||||
n = bAstNode and
|
||||
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
|
||||
nPat = nAttr + 1 and
|
||||
nTy = nPat + 1 and
|
||||
nTy = nAttr + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
@@ -618,9 +617,7 @@ private module Impl {
|
||||
result = e.getAttr(index - n) and
|
||||
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
|
||||
or
|
||||
index = nAttr and result = e.getPat() and partialPredicateCall = "Pat()"
|
||||
or
|
||||
index = nPat and result = e.getTy() and partialPredicateCall = "Ty()"
|
||||
index = nAttr and result = e.getTy() and partialPredicateCall = "Ty()"
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -885,32 +882,6 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfSelfParam(SelfParam e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bAstNode, int n, int nAttr, int nLifetime, int nName, int nTy |
|
||||
b = 0 and
|
||||
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
|
||||
n = bAstNode and
|
||||
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
|
||||
nLifetime = nAttr + 1 and
|
||||
nName = nLifetime + 1 and
|
||||
nTy = nName + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = e.getAttr(index - n) and
|
||||
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
|
||||
or
|
||||
index = nAttr and result = e.getLifetime() and partialPredicateCall = "Lifetime()"
|
||||
or
|
||||
index = nLifetime and result = e.getName() and partialPredicateCall = "Name()"
|
||||
or
|
||||
index = nName and result = e.getTy() and partialPredicateCall = "Ty()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfSourceFile(SourceFile e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bAstNode, int n, int nAttr, int nItem |
|
||||
b = 0 and
|
||||
@@ -2137,6 +2108,22 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfParam(Param e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bParamBase, int n, int nPat |
|
||||
b = 0 and
|
||||
bParamBase = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfParamBase(e, i, _)) | i) and
|
||||
n = bParamBase and
|
||||
nPat = n + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfParamBase(e, index - b, partialPredicateCall)
|
||||
or
|
||||
index = n and result = e.getPat() and partialPredicateCall = "Pat()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfParenExpr(ParenExpr e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bExpr, int n, int nAttr, int nExpr |
|
||||
b = 0 and
|
||||
@@ -2487,6 +2474,25 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfSelfParam(SelfParam e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bParamBase, int n, int nLifetime, int nName |
|
||||
b = 0 and
|
||||
bParamBase = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfParamBase(e, i, _)) | i) and
|
||||
n = bParamBase and
|
||||
nLifetime = n + 1 and
|
||||
nName = nLifetime + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfParamBase(e, index - b, partialPredicateCall)
|
||||
or
|
||||
index = n and result = e.getLifetime() and partialPredicateCall = "Lifetime()"
|
||||
or
|
||||
index = nLifetime and result = e.getName() and partialPredicateCall = "Name()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfSlicePat(SlicePat e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bPat, int n, int nPat |
|
||||
b = 0 and
|
||||
@@ -3621,8 +3627,6 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfNameRef(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfParam(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfParamList(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfPathSegment(e, index, partialAccessor)
|
||||
@@ -3643,8 +3647,6 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfReturnTypeSyntax(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfSelfParam(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfSourceFile(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfStmtList(e, index, partialAccessor)
|
||||
@@ -3751,6 +3753,8 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfOrPat(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfParam(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfParenExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfParenPat(e, index, partialAccessor)
|
||||
@@ -3787,6 +3791,8 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfReturnExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfSelfParam(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfSlicePat(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfSliceType(e, index, partialAccessor)
|
||||
|
||||
@@ -525,28 +525,18 @@ module Raw {
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A Param. For example:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* ```
|
||||
* A normal parameter, `Param`, or a self parameter `SelfParam`.
|
||||
*/
|
||||
class Param extends @param, AstNode {
|
||||
override string toString() { result = "Param" }
|
||||
class ParamBase extends @param_base, AstNode {
|
||||
/**
|
||||
* Gets the `index`th attr of this parameter base (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { param_base_attrs(this, index, result) }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this parameter (0-based).
|
||||
* Gets the ty of this parameter base, if it exists.
|
||||
*/
|
||||
Attr getAttr(int index) { param_attrs(this, index, result) }
|
||||
|
||||
/**
|
||||
* Gets the pat of this parameter, if it exists.
|
||||
*/
|
||||
Pat getPat() { param_pats(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the ty of this parameter, if it exists.
|
||||
*/
|
||||
TypeRef getTy() { param_ties(this, result) }
|
||||
TypeRef getTy() { param_base_ties(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -808,42 +798,6 @@ module Raw {
|
||||
override string toString() { result = "ReturnTypeSyntax" }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A SelfParam. For example:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* ```
|
||||
*/
|
||||
class SelfParam extends @self_param, AstNode {
|
||||
override string toString() { result = "SelfParam" }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this self parameter (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { self_param_attrs(this, index, result) }
|
||||
|
||||
/**
|
||||
* Holds if this self parameter is mut.
|
||||
*/
|
||||
predicate isMut() { self_param_is_mut(this) }
|
||||
|
||||
/**
|
||||
* Gets the lifetime of this self parameter, if it exists.
|
||||
*/
|
||||
Lifetime getLifetime() { self_param_lifetimes(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the name of this self parameter, if it exists.
|
||||
*/
|
||||
Name getName() { self_param_names(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the ty of this self parameter, if it exists.
|
||||
*/
|
||||
TypeRef getTy() { self_param_ties(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A SourceFile. For example:
|
||||
@@ -2281,6 +2235,24 @@ module Raw {
|
||||
Pat getPat(int index) { or_pat_pats(this, index, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A parameter in a function or method. For example `x` in:
|
||||
* ```rust
|
||||
* fn new(x: T) -> Foo<T> {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Param extends @param, ParamBase {
|
||||
override string toString() { result = "Param" }
|
||||
|
||||
/**
|
||||
* Gets the pat of this parameter, if it exists.
|
||||
*/
|
||||
Pat getPat() { param_pats(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A ParenExpr. For example:
|
||||
@@ -2717,6 +2689,34 @@ module Raw {
|
||||
Expr getExpr() { return_expr_exprs(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A `self` parameter. For example `self` in:
|
||||
* ```rust
|
||||
* fn push(&mut self, value: T) {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class SelfParam extends @self_param, ParamBase {
|
||||
override string toString() { result = "SelfParam" }
|
||||
|
||||
/**
|
||||
* Holds if this self parameter is mut.
|
||||
*/
|
||||
predicate isMut() { self_param_is_mut(this) }
|
||||
|
||||
/**
|
||||
* Gets the lifetime of this self parameter, if it exists.
|
||||
*/
|
||||
Lifetime getLifetime() { self_param_lifetimes(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the name of this self parameter, if it exists.
|
||||
*/
|
||||
Name getName() { self_param_names(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A slice pattern. For example:
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
|
||||
private import codeql.rust.elements.internal.generated.Synth
|
||||
private import codeql.rust.elements.internal.generated.Raw
|
||||
import codeql.rust.elements.internal.AstNodeImpl::Impl as AstNodeImpl
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.Lifetime
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.TypeRef
|
||||
import codeql.rust.elements.internal.ParamBaseImpl::Impl as ParamBaseImpl
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `SelfParam` and should not
|
||||
@@ -18,34 +16,18 @@ import codeql.rust.elements.TypeRef
|
||||
*/
|
||||
module Generated {
|
||||
/**
|
||||
* A SelfParam. For example:
|
||||
* A `self` parameter. For example `self` in:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* fn push(&mut self, value: T) {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
* INTERNAL: Do not reference the `Generated::SelfParam` class directly.
|
||||
* Use the subclass `SelfParam`, where the following predicates are available.
|
||||
*/
|
||||
class SelfParam extends Synth::TSelfParam, AstNodeImpl::AstNode {
|
||||
class SelfParam extends Synth::TSelfParam, ParamBaseImpl::ParamBase {
|
||||
override string getAPrimaryQlClass() { result = "SelfParam" }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this self parameter (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) {
|
||||
result =
|
||||
Synth::convertAttrFromRaw(Synth::convertSelfParamToRaw(this).(Raw::SelfParam).getAttr(index))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets any of the attrs of this self parameter.
|
||||
*/
|
||||
final Attr getAnAttr() { result = this.getAttr(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of attrs of this self parameter.
|
||||
*/
|
||||
final int getNumberOfAttrs() { result = count(int i | exists(this.getAttr(i))) }
|
||||
|
||||
/**
|
||||
* Holds if this self parameter is mut.
|
||||
*/
|
||||
@@ -78,18 +60,5 @@ module Generated {
|
||||
* Holds if `getName()` exists.
|
||||
*/
|
||||
final predicate hasName() { exists(this.getName()) }
|
||||
|
||||
/**
|
||||
* Gets the ty of this self parameter, if it exists.
|
||||
*/
|
||||
TypeRef getTy() {
|
||||
result =
|
||||
Synth::convertTypeRefFromRaw(Synth::convertSelfParamToRaw(this).(Raw::SelfParam).getTy())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `getTy()` exists.
|
||||
*/
|
||||
final predicate hasTy() { exists(this.getTy()) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,12 +624,12 @@ module Synth {
|
||||
TExpr or TExternItem or TExternItemList or TFieldList or TFormatArgsArg or TGenericArg or
|
||||
TGenericArgList or TGenericParam or TGenericParamList or TItemList or TLabel or TLetElse or
|
||||
TLifetime or TMacroItems or TMacroStmts or TMatchArm or TMatchArmList or TMatchGuard or
|
||||
TMeta or TName or TNameRef or TParam or TParamList or TPat or TPathSegment or
|
||||
TMeta or TName or TNameRef or TParamBase or TParamList or TPat or TPathSegment or
|
||||
TRecordExprField or TRecordExprFieldList or TRecordField or TRecordPatField or
|
||||
TRecordPatFieldList or TRename or TResolvable or TRetType or TReturnTypeSyntax or
|
||||
TSelfParam or TSourceFile or TStmt or TStmtList or TToken or TTokenTree or TTupleField or
|
||||
TTypeBound or TTypeBoundList or TTypeRef or TUseTree or TUseTreeList or TVariant or
|
||||
TVariantList or TVisibility or TWhereClause or TWherePred;
|
||||
TSourceFile or TStmt or TStmtList or TToken or TTokenTree or TTupleField or TTypeBound or
|
||||
TTypeBoundList or TTypeRef or TUseTree or TUseTreeList or TVariant or TVariantList or
|
||||
TVisibility or TWhereClause or TWherePred;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
@@ -695,6 +695,11 @@ module Synth {
|
||||
*/
|
||||
class TLoopingExpr = TForExpr or TLoopExpr or TWhileExpr;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class TParamBase = TParam or TSelfParam;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
@@ -1699,7 +1704,7 @@ module Synth {
|
||||
or
|
||||
result = convertNameRefFromRaw(e)
|
||||
or
|
||||
result = convertParamFromRaw(e)
|
||||
result = convertParamBaseFromRaw(e)
|
||||
or
|
||||
result = convertParamListFromRaw(e)
|
||||
or
|
||||
@@ -1725,8 +1730,6 @@ module Synth {
|
||||
or
|
||||
result = convertReturnTypeSyntaxFromRaw(e)
|
||||
or
|
||||
result = convertSelfParamFromRaw(e)
|
||||
or
|
||||
result = convertSourceFileFromRaw(e)
|
||||
or
|
||||
result = convertStmtFromRaw(e)
|
||||
@@ -1984,6 +1987,16 @@ module Synth {
|
||||
result = convertWhileExprFromRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw DB element to a synthesized `TParamBase`, if possible.
|
||||
*/
|
||||
TParamBase convertParamBaseFromRaw(Raw::Element e) {
|
||||
result = convertParamFromRaw(e)
|
||||
or
|
||||
result = convertSelfParamFromRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw DB element to a synthesized `TPat`, if possible.
|
||||
@@ -3065,7 +3078,7 @@ module Synth {
|
||||
or
|
||||
result = convertNameRefToRaw(e)
|
||||
or
|
||||
result = convertParamToRaw(e)
|
||||
result = convertParamBaseToRaw(e)
|
||||
or
|
||||
result = convertParamListToRaw(e)
|
||||
or
|
||||
@@ -3091,8 +3104,6 @@ module Synth {
|
||||
or
|
||||
result = convertReturnTypeSyntaxToRaw(e)
|
||||
or
|
||||
result = convertSelfParamToRaw(e)
|
||||
or
|
||||
result = convertSourceFileToRaw(e)
|
||||
or
|
||||
result = convertStmtToRaw(e)
|
||||
@@ -3350,6 +3361,16 @@ module Synth {
|
||||
result = convertWhileExprToRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TParamBase` to a raw DB element, if possible.
|
||||
*/
|
||||
Raw::Element convertParamBaseToRaw(TParamBase e) {
|
||||
result = convertParamToRaw(e)
|
||||
or
|
||||
result = convertSelfParamToRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TPat` to a raw DB element, if possible.
|
||||
|
||||
@@ -162,7 +162,7 @@ locatable_locations(
|
||||
| @meta
|
||||
| @name
|
||||
| @name_ref
|
||||
| @param
|
||||
| @param_base
|
||||
| @param_list
|
||||
| @pat
|
||||
| @path_segment
|
||||
@@ -175,7 +175,6 @@ locatable_locations(
|
||||
| @resolvable
|
||||
| @ret_type
|
||||
| @return_type_syntax
|
||||
| @self_param
|
||||
| @source_file
|
||||
| @stmt
|
||||
| @stmt_list
|
||||
@@ -582,26 +581,21 @@ name_ref_texts(
|
||||
string text: string ref
|
||||
);
|
||||
|
||||
params(
|
||||
unique int id: @param
|
||||
);
|
||||
@param_base =
|
||||
@param
|
||||
| @self_param
|
||||
;
|
||||
|
||||
#keyset[id, index]
|
||||
param_attrs(
|
||||
int id: @param ref,
|
||||
param_base_attrs(
|
||||
int id: @param_base ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
param_pats(
|
||||
int id: @param ref,
|
||||
int pat: @pat ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
param_ties(
|
||||
int id: @param ref,
|
||||
param_base_ties(
|
||||
int id: @param_base ref,
|
||||
int ty: @type_ref ref
|
||||
);
|
||||
|
||||
@@ -844,40 +838,6 @@ return_type_syntaxes(
|
||||
unique int id: @return_type_syntax
|
||||
);
|
||||
|
||||
self_params(
|
||||
unique int id: @self_param
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
self_param_attrs(
|
||||
int id: @self_param ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
self_param_is_mut(
|
||||
int id: @self_param ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
self_param_lifetimes(
|
||||
int id: @self_param ref,
|
||||
int lifetime: @lifetime ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
self_param_names(
|
||||
int id: @self_param ref,
|
||||
int name: @name ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
self_param_ties(
|
||||
int id: @self_param ref,
|
||||
int ty: @type_ref ref
|
||||
);
|
||||
|
||||
source_files(
|
||||
unique int id: @source_file
|
||||
);
|
||||
@@ -1986,6 +1946,16 @@ or_pat_pats(
|
||||
int pat: @pat ref
|
||||
);
|
||||
|
||||
params(
|
||||
unique int id: @param
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
param_pats(
|
||||
int id: @param ref,
|
||||
int pat: @pat ref
|
||||
);
|
||||
|
||||
paren_exprs(
|
||||
unique int id: @paren_expr
|
||||
);
|
||||
@@ -2296,6 +2266,27 @@ return_expr_exprs(
|
||||
int expr: @expr ref
|
||||
);
|
||||
|
||||
self_params(
|
||||
unique int id: @self_param
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
self_param_is_mut(
|
||||
int id: @self_param ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
self_param_lifetimes(
|
||||
int id: @self_param ref,
|
||||
int lifetime: @lifetime ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
self_param_names(
|
||||
int id: @self_param ref,
|
||||
int name: @name ref
|
||||
);
|
||||
|
||||
slice_pats(
|
||||
unique int id: @slice_pat
|
||||
);
|
||||
|
||||
@@ -75,7 +75,7 @@ NameRef/gen_name_ref.rs 41307c2f7ca82d28217129639e556bd4c91221cf3a4170250b313fd5
|
||||
NeverType/gen_never_type.rs a5413fab6a45dcfc2ff0ec5c8308b6c515963212ec4aa9edb9a96ec9a7e96830 a5413fab6a45dcfc2ff0ec5c8308b6c515963212ec4aa9edb9a96ec9a7e96830
|
||||
OffsetOfExpr/gen_offset_of_expr.rs 8e2077b4d7b85c91c17c3630511bc4f929950e9007261cbf0471c4a064c4b934 8e2077b4d7b85c91c17c3630511bc4f929950e9007261cbf0471c4a064c4b934
|
||||
OrPat/gen_or_pat.rs 71feef6e056bfe4cc8c22c9eb54fa3fecef613606769061d0efd059adbbd6f56 71feef6e056bfe4cc8c22c9eb54fa3fecef613606769061d0efd059adbbd6f56
|
||||
Param/gen_param.rs 6c9e4a972b2dc0702dc29ebcbdcbe2c6a433b3cd372ad6924feedcea4698faba 6c9e4a972b2dc0702dc29ebcbdcbe2c6a433b3cd372ad6924feedcea4698faba
|
||||
Param/gen_param.rs 39f3979d6cb10e4c43e0b5601af2a92b7520a75a104211955bbbb5e6f13e9db9 39f3979d6cb10e4c43e0b5601af2a92b7520a75a104211955bbbb5e6f13e9db9
|
||||
ParamList/gen_param_list.rs ef2e83d0aed45b969fe78dd717e87ef3c1f848e6179cfb4dc3cb136f1836b998 ef2e83d0aed45b969fe78dd717e87ef3c1f848e6179cfb4dc3cb136f1836b998
|
||||
ParenExpr/gen_paren_expr.rs dd0c4a21a92e54e8a6151145e013cbec9c9e1cad093d572e293b4f51d6c44aea dd0c4a21a92e54e8a6151145e013cbec9c9e1cad093d572e293b4f51d6c44aea
|
||||
ParenPat/gen_paren_pat.rs c8d18521b9a0b7d39841eb72e3895914aa652b7235dea42ed12a4eb280e3bf0e c8d18521b9a0b7d39841eb72e3895914aa652b7235dea42ed12a4eb280e3bf0e
|
||||
@@ -104,7 +104,7 @@ RestPat/gen_rest_pat.rs e762bf7537225f97da751c5dca6a2cd3836ad7579b68c748b8c6cba6
|
||||
RetType/gen_ret_type.rs 0947aed0974461b7a5b56bbc5fe36131663bde715c37302345d4eee23b71c825 0947aed0974461b7a5b56bbc5fe36131663bde715c37302345d4eee23b71c825
|
||||
ReturnExpr/gen_return_expr.rs 4f6ef29d7b3c60d6d71d1a6034a0721671f517428ba21897361a92b01009d38f 4f6ef29d7b3c60d6d71d1a6034a0721671f517428ba21897361a92b01009d38f
|
||||
ReturnTypeSyntax/gen_return_type_syntax.rs 0b11a4cc400f9a2001996f99d61391bdb636e8aea036f587cf18ad6a957fe496 0b11a4cc400f9a2001996f99d61391bdb636e8aea036f587cf18ad6a957fe496
|
||||
SelfParam/gen_self_param.rs b7bf9f23fedad6f1a15f02e5fac33fc2c68ec3409b44f24142c2fdec1e5e6f1f b7bf9f23fedad6f1a15f02e5fac33fc2c68ec3409b44f24142c2fdec1e5e6f1f
|
||||
SelfParam/gen_self_param.rs 9be528c454e2734292d54550f8850ae8e48e1558da46dcf7f06fc7a7a8c3e569 9be528c454e2734292d54550f8850ae8e48e1558da46dcf7f06fc7a7a8c3e569
|
||||
SlicePat/gen_slice_pat.rs df4a6692f5100aa11dd777561400ce71e37b85f2363b0638c21975a1771b15d5 df4a6692f5100aa11dd777561400ce71e37b85f2363b0638c21975a1771b15d5
|
||||
SliceType/gen_slice_type.rs 073282f4755994473933db7e4f1e4d34a80363d7e331299ec4ac1a2d6a235b86 073282f4755994473933db7e4f1e4d34a80363d7e331299ec4ac1a2d6a235b86
|
||||
SourceFile/gen_source_file.rs a7a1d4fa77b53adb6fbc031bf7ab49cf7c8787728ba0a687c348b5eefbb5b9df a7a1d4fa77b53adb6fbc031bf7ab49cf7c8787728ba0a687c348b5eefbb5b9df
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| gen_param.rs:5:12:5:15 | ...: T | getNumberOfAttrs: | 0 | hasTy: | yes | hasPat: | yes |
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import codeql.rust.elements
|
||||
import TestUtils
|
||||
|
||||
from Param x, int getNumberOfAttrs, string hasPat, string hasTy
|
||||
from Param x, int getNumberOfAttrs, string hasTy, string hasPat
|
||||
where
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
getNumberOfAttrs = x.getNumberOfAttrs() and
|
||||
(if x.hasPat() then hasPat = "yes" else hasPat = "no") and
|
||||
if x.hasTy() then hasTy = "yes" else hasTy = "no"
|
||||
select x, "getNumberOfAttrs:", getNumberOfAttrs, "hasPat:", hasPat, "hasTy:", hasTy
|
||||
(if x.hasTy() then hasTy = "yes" else hasTy = "no") and
|
||||
if x.hasPat() then hasPat = "yes" else hasPat = "no"
|
||||
select x, "getNumberOfAttrs:", getNumberOfAttrs, "hasTy:", hasTy, "hasPat:", hasPat
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| gen_param.rs:5:12:5:15 | ...: T | gen_param.rs:5:12:5:12 | x |
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| gen_param.rs:5:12:5:15 | ...: T | gen_param.rs:5:15:5:15 | T |
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// generated by codegen, do not edit
|
||||
|
||||
fn test_param() -> () {
|
||||
// A Param. For example:
|
||||
todo!()
|
||||
// A parameter in a function or method. For example `x` in:
|
||||
fn new(x: T) -> Foo<T> {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| gen_self_param.rs:5:13:5:21 | SelfParam | getNumberOfAttrs: | 0 | hasTy: | no | isMut: | yes | hasLifetime: | no | hasName: | yes |
|
||||
|
||||
@@ -3,14 +3,14 @@ import codeql.rust.elements
|
||||
import TestUtils
|
||||
|
||||
from
|
||||
SelfParam x, int getNumberOfAttrs, string isMut, string hasLifetime, string hasName, string hasTy
|
||||
SelfParam x, int getNumberOfAttrs, string hasTy, string isMut, string hasLifetime, string hasName
|
||||
where
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
getNumberOfAttrs = x.getNumberOfAttrs() and
|
||||
(if x.hasTy() then hasTy = "yes" else hasTy = "no") and
|
||||
(if x.isMut() then isMut = "yes" else isMut = "no") and
|
||||
(if x.hasLifetime() then hasLifetime = "yes" else hasLifetime = "no") and
|
||||
(if x.hasName() then hasName = "yes" else hasName = "no") and
|
||||
if x.hasTy() then hasTy = "yes" else hasTy = "no"
|
||||
select x, "getNumberOfAttrs:", getNumberOfAttrs, "isMut:", isMut, "hasLifetime:", hasLifetime,
|
||||
"hasName:", hasName, "hasTy:", hasTy
|
||||
if x.hasName() then hasName = "yes" else hasName = "no"
|
||||
select x, "getNumberOfAttrs:", getNumberOfAttrs, "hasTy:", hasTy, "isMut:", isMut, "hasLifetime:",
|
||||
hasLifetime, "hasName:", hasName
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| gen_self_param.rs:5:13:5:21 | SelfParam | gen_self_param.rs:5:18:5:21 | self |
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// generated by codegen, do not edit
|
||||
|
||||
fn test_self_param() -> () {
|
||||
// A SelfParam. For example:
|
||||
todo!()
|
||||
// A `self` parameter. For example `self` in:
|
||||
fn push(&mut self, value: T) {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1324,14 +1324,29 @@ class _:
|
||||
"""
|
||||
|
||||
|
||||
@annotate(Param, cfg = True)
|
||||
class ParamBase(AstNode):
|
||||
"""
|
||||
A normal parameter, `Param`, or a self parameter `SelfParam`.
|
||||
"""
|
||||
attrs: list["Attr"] | child
|
||||
ty: optional["TypeRef"] | child
|
||||
|
||||
@annotate(ParamBase, cfg = True)
|
||||
class _:
|
||||
pass
|
||||
|
||||
@annotate(Param, replace_bases={AstNode: ParamBase}, cfg = True)
|
||||
class _:
|
||||
"""
|
||||
A Param. For example:
|
||||
A parameter in a function or method. For example `x` in:
|
||||
```rust
|
||||
todo!()
|
||||
fn new(x: T) -> Foo<T> {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
"""
|
||||
attrs: drop
|
||||
ty: drop
|
||||
|
||||
|
||||
@annotate(ParamList)
|
||||
@@ -1494,14 +1509,18 @@ class _:
|
||||
"""
|
||||
|
||||
|
||||
@annotate(SelfParam, cfg = True)
|
||||
@annotate(SelfParam, replace_bases={AstNode: ParamBase}, cfg = True)
|
||||
class _:
|
||||
"""
|
||||
A SelfParam. For example:
|
||||
A `self` parameter. For example `self` in:
|
||||
```rust
|
||||
todo!()
|
||||
fn push(&mut self, value: T) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
"""
|
||||
attrs: drop
|
||||
ty: drop
|
||||
|
||||
|
||||
@annotate(SliceType)
|
||||
|
||||
Reference in New Issue
Block a user