mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Add 'BlockBase' class
This commit is contained in:
19
rust/.generated.list
generated
19
rust/.generated.list
generated
@@ -12,6 +12,8 @@ ql/lib/codeql/rust/elements/BinaryOpConstructor.qll 4e9b81d972c3ce4cd38baa0bbb5a
|
||||
ql/lib/codeql/rust/elements/BindPat.qll f0209f781d8a14ab7fbb4b4d6a654469aecb0ff1a8ff4810f18a90f3b171e1c3 9734b7907855e46eeded6c3f59912a16212f7e8639fba35c740bb04462240287
|
||||
ql/lib/codeql/rust/elements/BindPatConstructor.qll 2bbcc296bcdcd945313d83294b90d327c51c9f1e96f92d37dd10bf0c32dfaf6a 612b4fc651f32129155727e866796edee8fff939614c6fd0b7baa1392930a38c
|
||||
ql/lib/codeql/rust/elements/Block.qll 03adb9118a899bfdd3790d82426eb6ee3df83d03d6e0eceb5d05bc9b8f08c576 c65f594a7d576889ddb13b3ec16175e1ceb09e9f289a23e91708be6d728573bb
|
||||
ql/lib/codeql/rust/elements/BlockBase.qll 3ce5ef025d1fb293a6708e74a78761590a6ed3fdeabb70795f18170598d45566 6aeac52ec999f2b2e8f96c425a44c4eb3a3efb77bbcf76e9c496137c5773769b
|
||||
ql/lib/codeql/rust/elements/BlockConstructor.qll 07cd9123ae847a04b84fd410eee835fbf1088e88d1f1bfcf3e2a66ee5ac3ca8c 15d9e5be5a43c70aea9a280e114889f277fc3c2d83638d9e5cb7dbfb559c56c4
|
||||
ql/lib/codeql/rust/elements/Box.qll 8fa74f14d72cb8613e9ddc4effc19054cb745c91582aa7a440d68f02b9c13b9c 1e196173be41e5059fc538c1cda01ccfea644425030584e2689c68abf7850935
|
||||
ql/lib/codeql/rust/elements/BoxConstructor.qll 9a76f8b87367812ac7be252d04802f09a97659869098391bcdd46e6da72840cc 8225e3743257dd1a927a7c6eabdfd082011e1124ffeb10e4020b52c41556fa12
|
||||
ql/lib/codeql/rust/elements/BoxPat.qll 1df08d5443c63e21d40d25023da58da50bd6cf6e156b9f5dbd6d41a3193faee9 9837752be4d4a1c3f16d6438bd361c596b6b983d9ae4e486083651e8f4e090ff
|
||||
@@ -117,15 +119,16 @@ ql/lib/codeql/rust/elements/Yeet.qll 07f967352be486b7e2b787c292c16195a7084699cbd
|
||||
ql/lib/codeql/rust/elements/YeetConstructor.qll 835afa5ff4b4102335525c41d67380e59f272f95b4b7b0196e0475eae4b9f738 6c51946d661aea16d91010e0639b4ea8f3d161bd56a029e955dc7f7bca025c00
|
||||
ql/lib/codeql/rust/elements/Yield.qll 9a484b5b5c2c32ef61395213c376ce4b1ef7f699f08330d08faf071ea8919af1 e45fe09b794a2a05a1c125d112dfb36d9c7d538ff1953440d6c580cd8c987f8a
|
||||
ql/lib/codeql/rust/elements/YieldConstructor.qll 16f393593cf9cf126f048c6f36eba7ca45e78c44577c7bda51c9a66bac95487e f49c9c3d4d17f64f44111bea2bb197cf8b11a0aa88b53b9a527c6aab4733c4b5
|
||||
ql/lib/codeql/rust/elements.qll 2f6912dc51cebbfb6e69064c05ce139bdaa9fcc3cabc0fceab390217b327c0c6 2f6912dc51cebbfb6e69064c05ce139bdaa9fcc3cabc0fceab390217b327c0c6
|
||||
ql/lib/codeql/rust/elements.qll e1531dc71a60381eb4b708b966a8f9645ef39cb1aebd2cf7a5dfd2e17fff6c5a e1531dc71a60381eb4b708b966a8f9645ef39cb1aebd2cf7a5dfd2e17fff6c5a
|
||||
ql/lib/codeql/rust/generated/Array.qll 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622
|
||||
ql/lib/codeql/rust/generated/AstNode.qll 0598fac7859906f4103124270dfb2fbdb838387b1c45000bf50a4b62c797ec41 f47c84878c7c9676109e358073bddab92a1dbeb4d977d236ecc1eae44d81c894
|
||||
ql/lib/codeql/rust/generated/AsyncBlock.qll 4fbb02d4afe512201d78849f52845f7533d7c0482cea84bbf0ef9952fafdfcfa 4fbb02d4afe512201d78849f52845f7533d7c0482cea84bbf0ef9952fafdfcfa
|
||||
ql/lib/codeql/rust/generated/AsyncBlock.qll 8ba28deb0ad9d6a887df2033eca4e4a4789a24c09e5ca720d38474226c6dbb0c 8ba28deb0ad9d6a887df2033eca4e4a4789a24c09e5ca720d38474226c6dbb0c
|
||||
ql/lib/codeql/rust/generated/Await.qll f5d65ee72d03205b95b9f507a4da5706f5c66d0da8b4a8a5d67bfae5643a4766 382ad8a5e1098ec697370cdf5453404128abd9d56a1e578e0255aa29d33fcf74
|
||||
ql/lib/codeql/rust/generated/Become.qll 7cfe61271eb91293014ebf16cd1029454705f4b569bba8afeec7d683f378efaf 9a31140d67ae8e77762aa2bd09ab018c88fe464a1b2205035e957d889abfe42a
|
||||
ql/lib/codeql/rust/generated/BinaryOp.qll ec80f6cb6a0a03496814a629ecc8736f77c46e22a6c26b4e11fe1e650eb91441 67cd9c875556034a7afe78857c2d50d9ae1af084bee87e0d0c691c8baaaae72f
|
||||
ql/lib/codeql/rust/generated/BindPat.qll 15d3a33c5f56f7659a331f72735f00930fddd6066659e54c5c19d5e7eb8ef078 bc0a916622b2c426b71760caf15b8e005eed276e06e04d04cc5f19f4c31c34f6
|
||||
ql/lib/codeql/rust/generated/Block.qll 5f769e5bf7484552e1cee031d7ba1ac8811e8d1e1a712d44fc28a3c2ec88a672 5d3da26a524cb8c79f190cc9c960c989752ea651055d7fc882de58ee9a05bf19
|
||||
ql/lib/codeql/rust/generated/Block.qll 7a50beadbbe3e7f778797b4a69ba20c56c389803335cec54a701761e74d94cf8 93c5148dc0540fca7233a231ecd5d4e744a1e73398306a652db521ce560bba47
|
||||
ql/lib/codeql/rust/generated/BlockBase.qll f1984b819cb8d2257c7e6323041c32bc106153c1a3fba75f052a545b84e9f09f 7e2767cee8967b5b8a53c1ad1de578a11f46629422ff1b2cebe051fe53293a91
|
||||
ql/lib/codeql/rust/generated/Box.qll c64ff6a3e495d5729e091d275f04573ca820df2df1f42773dd04b0da0bf1d3d1 6d0778ae8347530f9ed5be9b24206f02d9437dd5265fdb308dfefce70f5d8829
|
||||
ql/lib/codeql/rust/generated/BoxPat.qll b69ba2bc341a1bf4c613279e45fb97a530619d4148d5ccc4f05436a316db29eb bf52730243bd1836d5890c745232aba50544c2046d00e80e7d22eebcd104f821
|
||||
ql/lib/codeql/rust/generated/Break.qll a1131a39a8b57398937b7e35108c83a92aabb284289acf5e8da1bbb9e603ae8d 4a2059cc94e028f080e984e485f1760c92ad2def6993ba68e023a2c9720ba00a
|
||||
@@ -163,14 +166,14 @@ ql/lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a2568
|
||||
ql/lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62
|
||||
ql/lib/codeql/rust/generated/OffsetOf.qll 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291
|
||||
ql/lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398
|
||||
ql/lib/codeql/rust/generated/ParentChild.qll 0f030634cebcef8f5057032eac1507db56be4a63b3e6d5dc1bc2ca7a5efb47ae cfd2a4a19279118616d435cbfe4141d8cd2bc4bba62ac389f35c752d7c46924e
|
||||
ql/lib/codeql/rust/generated/ParentChild.qll 9365b29f55a6ca6353a0fc61ec9ac01a53ca5c12c997b804ec143ca6de5600ac 5d39a2063541af98d60fc6b989c2f3aacaa803422b718414f095d3af02a88e79
|
||||
ql/lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7
|
||||
ql/lib/codeql/rust/generated/Path.qll ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75
|
||||
ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524
|
||||
ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573
|
||||
ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06
|
||||
ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4
|
||||
ql/lib/codeql/rust/generated/Raw.qll 9e527657ad4eaa36585a786e83a03adb93493b496bd241bef1cc6acefab37009 8974d8dcd0914c109e6792f448bb1d504ff0cee73ee883134dc5f64b2a643c8f
|
||||
ql/lib/codeql/rust/generated/Raw.qll 8285e7937d3a375b5a882ecccbe2ac8db3cbff59bdb2ed4f7a32059362826255 beaceb79727f4a1244238599c39cdd696e6be13a8c1c9c49c3bac8845b881558
|
||||
ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243
|
||||
ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7
|
||||
ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd
|
||||
@@ -178,8 +181,8 @@ ql/lib/codeql/rust/generated/RefPat.qll 3525331e8ba25a8612324e860423a39ddb29e8eb
|
||||
ql/lib/codeql/rust/generated/Return.qll 9664cd51675a9a6ddfe7795b79f491c3834588e0bbc3b25863c621486f46a5f7 b38067c9bbcb0c4a4d2b59d76e81afcca7bc1b72caea91c1a79a7b7526390511
|
||||
ql/lib/codeql/rust/generated/SlicePat.qll f013be99f2c287e1d97aac95e72010c1e0a95a5efef90fde10e22a828345cac5 3a9c56d4e13f3b6a8e677586912f5a9b1e090b543911c31be33947479b0e9533
|
||||
ql/lib/codeql/rust/generated/Stmt.qll 55688c8f42f6e7fd1b871e572d75fac60d0543e38c4be4638abbb00187651d3d f978006a8453137f989249e849a7c935a090da3a9b0116145da80068760e12fd
|
||||
ql/lib/codeql/rust/generated/Synth.qll b0227cc6042034c1f5ad6829b4b8d2574ef16cf1a5b4dd81bb172a0756fae4a2 209b97b56028449709f9e1477ed9f060c6ac3a51f0a72c84d2dc58c6c9cc0c82
|
||||
ql/lib/codeql/rust/generated/SynthConstructors.qll c3393b74c66e2d9606e82581f393491152f97ebbc91d49f1688a62d071d6e28d c3393b74c66e2d9606e82581f393491152f97ebbc91d49f1688a62d071d6e28d
|
||||
ql/lib/codeql/rust/generated/Synth.qll 9c71ab766b07e4d1c2b89e6ae0631a4f4e2b5dfda12f1e55dd5544327217a463 e56058f18c9b9e9d540bd5f12f9600f4e3522e18f67919119e60975f35a46e79
|
||||
ql/lib/codeql/rust/generated/SynthConstructors.qll bd3b69d1a153260761399fdc10b589c87f1295e894946b8e33d672c14b08df5f bd3b69d1a153260761399fdc10b589c87f1295e894946b8e33d672c14b08df5f
|
||||
ql/lib/codeql/rust/generated/Tuple.qll 3fde94f0c23c6af6bcb58d0245a3cd0a8bbd6ef7999fbeed805baf2615e6226d c1aa7fc201aebb34dc6cd7760e817032b86fd16b8facac450c74deda860bc821
|
||||
ql/lib/codeql/rust/generated/TuplePat.qll fdb2c66fe6291106fe125de6a91c4d74b2c715d276c2fee9751d0523b618d095 330098460ccac28479a2b522048d6f1191bf01b40b3eceef4adf722c01c8360b
|
||||
ql/lib/codeql/rust/generated/TupleStructPat.qll 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36
|
||||
@@ -188,7 +191,7 @@ ql/lib/codeql/rust/generated/UnaryOp.qll fa587434c234c68606e3d0e32f6f07f89fa468d
|
||||
ql/lib/codeql/rust/generated/Underscore.qll d9980518479f771e164e4fc8d4c180f2a16691afbea65aa163939bae89e9005d d9980518479f771e164e4fc8d4c180f2a16691afbea65aa163939bae89e9005d
|
||||
ql/lib/codeql/rust/generated/UnknownFile.qll ec9d1a3f15ecbf1743d4e39cb3b2f217aa9b54951c93302c2c4c238c3f0ce595 ec9d1a3f15ecbf1743d4e39cb3b2f217aa9b54951c93302c2c4c238c3f0ce595
|
||||
ql/lib/codeql/rust/generated/UnknownLocation.qll a19e2838c52d702d268ae530f3dbd6fcd8bb28a237a52636a960f225454103cf a19e2838c52d702d268ae530f3dbd6fcd8bb28a237a52636a960f225454103cf
|
||||
ql/lib/codeql/rust/generated/UnsafeBlock.qll c15dcb7b1ea1b4b269bd7eba4cc798852d714319d16495ba660f4f34cfd70306 c15dcb7b1ea1b4b269bd7eba4cc798852d714319d16495ba660f4f34cfd70306
|
||||
ql/lib/codeql/rust/generated/UnsafeBlock.qll 2a968ab223354bd81527fe53c59d02364f4389536fb75da3347771e1cf798560 2a968ab223354bd81527fe53c59d02364f4389536fb75da3347771e1cf798560
|
||||
ql/lib/codeql/rust/generated/WildPat.qll 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8
|
||||
ql/lib/codeql/rust/generated/Yeet.qll 41b05d32a1b93cee770d6706cc044efe8ce57f11ae2f009c59666264cd1aaec1 8a6c8a1ae59e5a7e1b64abea85f6362c0460cbd5fcace1520b213ef5e08331ef
|
||||
ql/lib/codeql/rust/generated/Yield.qll afefea932d770b61b633feeaa05973943c2bb45ea3cd4f960a0be1bbce33a405 c975fba823b05ad40b3c1bd908880e65511b59f9e6882fa207009194a45134a0
|
||||
|
||||
3
rust/.gitattributes
generated
vendored
3
rust/.gitattributes
generated
vendored
@@ -14,6 +14,8 @@
|
||||
/ql/lib/codeql/rust/elements/BindPat.qll linguist-generated
|
||||
/ql/lib/codeql/rust/elements/BindPatConstructor.qll linguist-generated
|
||||
/ql/lib/codeql/rust/elements/Block.qll linguist-generated
|
||||
/ql/lib/codeql/rust/elements/BlockBase.qll linguist-generated
|
||||
/ql/lib/codeql/rust/elements/BlockConstructor.qll linguist-generated
|
||||
/ql/lib/codeql/rust/elements/Box.qll linguist-generated
|
||||
/ql/lib/codeql/rust/elements/BoxConstructor.qll linguist-generated
|
||||
/ql/lib/codeql/rust/elements/BoxPat.qll linguist-generated
|
||||
@@ -128,6 +130,7 @@
|
||||
/ql/lib/codeql/rust/generated/BinaryOp.qll linguist-generated
|
||||
/ql/lib/codeql/rust/generated/BindPat.qll linguist-generated
|
||||
/ql/lib/codeql/rust/generated/Block.qll linguist-generated
|
||||
/ql/lib/codeql/rust/generated/BlockBase.qll linguist-generated
|
||||
/ql/lib/codeql/rust/generated/Box.qll linguist-generated
|
||||
/ql/lib/codeql/rust/generated/BoxPat.qll linguist-generated
|
||||
/ql/lib/codeql/rust/generated/Break.qll linguist-generated
|
||||
|
||||
@@ -1245,7 +1245,6 @@ pub struct AsyncBlock {
|
||||
pub location: Option<trap::Label>,
|
||||
pub statements: Vec<trap::Label>,
|
||||
pub tail: Option<trap::Label>,
|
||||
pub label: Option<String>,
|
||||
}
|
||||
|
||||
impl TrapEntry for AsyncBlock {
|
||||
@@ -1259,10 +1258,38 @@ impl TrapEntry for AsyncBlock {
|
||||
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
|
||||
}
|
||||
for (i, &v) in self.statements.iter().enumerate() {
|
||||
out.add_tuple("block_statements", vec![trap::Arg::Label(id), i.into(), v.into()]);
|
||||
out.add_tuple("block_base_statements", vec![trap::Arg::Label(id), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.tail {
|
||||
out.add_tuple("block_tails", vec![trap::Arg::Label(id), v.into()]);
|
||||
out.add_tuple("block_base_tails", vec![trap::Arg::Label(id), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Block {
|
||||
pub id: TrapId,
|
||||
pub location: Option<trap::Label>,
|
||||
pub statements: Vec<trap::Label>,
|
||||
pub tail: Option<trap::Label>,
|
||||
pub label: Option<String>,
|
||||
}
|
||||
|
||||
impl TrapEntry for Block {
|
||||
fn extract_id(&mut self) -> TrapId {
|
||||
std::mem::replace(&mut self.id, TrapId::Star)
|
||||
}
|
||||
|
||||
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
|
||||
out.add_tuple("blocks", vec![trap::Arg::Label(id)]);
|
||||
if let Some(v) = self.location {
|
||||
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
|
||||
}
|
||||
for (i, &v) in self.statements.iter().enumerate() {
|
||||
out.add_tuple("block_base_statements", vec![trap::Arg::Label(id), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.tail {
|
||||
out.add_tuple("block_base_tails", vec![trap::Arg::Label(id), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.label {
|
||||
out.add_tuple("block_labels", vec![trap::Arg::Label(id), v.into()]);
|
||||
@@ -1276,7 +1303,6 @@ pub struct UnsafeBlock {
|
||||
pub location: Option<trap::Label>,
|
||||
pub statements: Vec<trap::Label>,
|
||||
pub tail: Option<trap::Label>,
|
||||
pub label: Option<String>,
|
||||
}
|
||||
|
||||
impl TrapEntry for UnsafeBlock {
|
||||
@@ -1290,13 +1316,10 @@ impl TrapEntry for UnsafeBlock {
|
||||
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
|
||||
}
|
||||
for (i, &v) in self.statements.iter().enumerate() {
|
||||
out.add_tuple("block_statements", vec![trap::Arg::Label(id), i.into(), v.into()]);
|
||||
out.add_tuple("block_base_statements", vec![trap::Arg::Label(id), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.tail {
|
||||
out.add_tuple("block_tails", vec![trap::Arg::Label(id), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.label {
|
||||
out.add_tuple("block_labels", vec![trap::Arg::Label(id), v.into()]);
|
||||
out.add_tuple("block_base_tails", vec![trap::Arg::Label(id), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
rust/ql/lib/codeql/rust/elements.qll
generated
1
rust/ql/lib/codeql/rust/elements.qll
generated
@@ -11,6 +11,7 @@ import codeql.rust.elements.Become
|
||||
import codeql.rust.elements.BinaryOp
|
||||
import codeql.rust.elements.BindPat
|
||||
import codeql.rust.elements.Block
|
||||
import codeql.rust.elements.BlockBase
|
||||
import codeql.rust.elements.Box
|
||||
import codeql.rust.elements.BoxPat
|
||||
import codeql.rust.elements.Break
|
||||
|
||||
8
rust/ql/lib/codeql/rust/elements/BlockBase.qll
generated
Normal file
8
rust/ql/lib/codeql/rust/elements/BlockBase.qll
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
// generated by codegen, remove this comment if you wish to edit this file
|
||||
/**
|
||||
* This module provides a hand-modifiable wrapper around the generated class `BlockBase`.
|
||||
*/
|
||||
|
||||
private import codeql.rust.generated.BlockBase
|
||||
|
||||
class BlockBase extends Generated::BlockBase { }
|
||||
14
rust/ql/lib/codeql/rust/elements/BlockConstructor.qll
generated
Normal file
14
rust/ql/lib/codeql/rust/elements/BlockConstructor.qll
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
// generated by codegen, remove this comment if you wish to edit this file
|
||||
/**
|
||||
* This module defines the hook used internally to tweak the characteristic predicate of
|
||||
* `Block` synthesized instances.
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
private import codeql.rust.generated.Raw
|
||||
|
||||
/**
|
||||
* The characteristic predicate of `Block` synthesized instances.
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
predicate constructBlock(Raw::Block id) { any() }
|
||||
4
rust/ql/lib/codeql/rust/generated/AsyncBlock.qll
generated
4
rust/ql/lib/codeql/rust/generated/AsyncBlock.qll
generated
@@ -6,7 +6,7 @@
|
||||
|
||||
private import codeql.rust.generated.Synth
|
||||
private import codeql.rust.generated.Raw
|
||||
import codeql.rust.elements.Block
|
||||
import codeql.rust.elements.BlockBase
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `AsyncBlock` and should not
|
||||
@@ -17,7 +17,7 @@ module Generated {
|
||||
* INTERNAL: Do not reference the `Generated::AsyncBlock` class directly.
|
||||
* Use the subclass `AsyncBlock`, where the following predicates are available.
|
||||
*/
|
||||
class AsyncBlock extends Synth::TAsyncBlock, Block {
|
||||
class AsyncBlock extends Synth::TAsyncBlock, BlockBase {
|
||||
override string getAPrimaryQlClass() { result = "AsyncBlock" }
|
||||
}
|
||||
}
|
||||
|
||||
35
rust/ql/lib/codeql/rust/generated/Block.qll
generated
35
rust/ql/lib/codeql/rust/generated/Block.qll
generated
@@ -6,8 +6,7 @@
|
||||
|
||||
private import codeql.rust.generated.Synth
|
||||
private import codeql.rust.generated.Raw
|
||||
import codeql.rust.elements.Expr
|
||||
import codeql.rust.elements.Stmt
|
||||
import codeql.rust.elements.BlockBase
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `Block` and should not
|
||||
@@ -18,36 +17,8 @@ module Generated {
|
||||
* INTERNAL: Do not reference the `Generated::Block` class directly.
|
||||
* Use the subclass `Block`, where the following predicates are available.
|
||||
*/
|
||||
class Block extends Synth::TBlock, Expr {
|
||||
/**
|
||||
* Gets the `index`th statement of this block (0-based).
|
||||
*/
|
||||
Stmt getStatement(int index) {
|
||||
result =
|
||||
Synth::convertStmtFromRaw(Synth::convertBlockToRaw(this).(Raw::Block).getStatement(index))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets any of the statements of this block.
|
||||
*/
|
||||
final Stmt getAStatement() { result = this.getStatement(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of statements of this block.
|
||||
*/
|
||||
final int getNumberOfStatements() { result = count(int i | exists(this.getStatement(i))) }
|
||||
|
||||
/**
|
||||
* Gets the tail of this block, if it exists.
|
||||
*/
|
||||
Expr getTail() {
|
||||
result = Synth::convertExprFromRaw(Synth::convertBlockToRaw(this).(Raw::Block).getTail())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `getTail()` exists.
|
||||
*/
|
||||
final predicate hasTail() { exists(this.getTail()) }
|
||||
class Block extends Synth::TBlock, BlockBase {
|
||||
override string getAPrimaryQlClass() { result = "Block" }
|
||||
|
||||
/**
|
||||
* Gets the label of this block, if it exists.
|
||||
|
||||
55
rust/ql/lib/codeql/rust/generated/BlockBase.qll
generated
Normal file
55
rust/ql/lib/codeql/rust/generated/BlockBase.qll
generated
Normal file
@@ -0,0 +1,55 @@
|
||||
// generated by codegen
|
||||
/**
|
||||
* This module provides the generated definition of `BlockBase`.
|
||||
* INTERNAL: Do not import directly.
|
||||
*/
|
||||
|
||||
private import codeql.rust.generated.Synth
|
||||
private import codeql.rust.generated.Raw
|
||||
import codeql.rust.elements.Expr
|
||||
import codeql.rust.elements.Stmt
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `BlockBase` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Generated {
|
||||
/**
|
||||
* INTERNAL: Do not reference the `Generated::BlockBase` class directly.
|
||||
* Use the subclass `BlockBase`, where the following predicates are available.
|
||||
*/
|
||||
class BlockBase extends Synth::TBlockBase, Expr {
|
||||
/**
|
||||
* Gets the `index`th statement of this block base (0-based).
|
||||
*/
|
||||
Stmt getStatement(int index) {
|
||||
result =
|
||||
Synth::convertStmtFromRaw(Synth::convertBlockBaseToRaw(this)
|
||||
.(Raw::BlockBase)
|
||||
.getStatement(index))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets any of the statements of this block base.
|
||||
*/
|
||||
final Stmt getAStatement() { result = this.getStatement(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of statements of this block base.
|
||||
*/
|
||||
final int getNumberOfStatements() { result = count(int i | exists(this.getStatement(i))) }
|
||||
|
||||
/**
|
||||
* Gets the tail of this block base, if it exists.
|
||||
*/
|
||||
Expr getTail() {
|
||||
result =
|
||||
Synth::convertExprFromRaw(Synth::convertBlockBaseToRaw(this).(Raw::BlockBase).getTail())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `getTail()` exists.
|
||||
*/
|
||||
final predicate hasTail() { exists(this.getTail()) }
|
||||
}
|
||||
}
|
||||
33
rust/ql/lib/codeql/rust/generated/ParentChild.qll
generated
33
rust/ql/lib/codeql/rust/generated/ParentChild.qll
generated
@@ -263,7 +263,7 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfBlock(Block e, int index, string partialPredicateCall) {
|
||||
private Element getImmediateChildOfBlockBase(BlockBase e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bExpr, int n |
|
||||
b = 0 and
|
||||
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
|
||||
@@ -887,14 +887,27 @@ private module Impl {
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfAsyncBlock(AsyncBlock e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bBlock, int n |
|
||||
exists(int b, int bBlockBase, int n |
|
||||
b = 0 and
|
||||
bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and
|
||||
n = bBlock and
|
||||
bBlockBase = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlockBase(e, i, _)) | i) and
|
||||
n = bBlockBase and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfBlock(e, index - b, partialPredicateCall)
|
||||
result = getImmediateChildOfBlockBase(e, index - b, partialPredicateCall)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfBlock(Block e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bBlockBase, int n |
|
||||
b = 0 and
|
||||
bBlockBase = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlockBase(e, i, _)) | i) and
|
||||
n = bBlockBase and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfBlockBase(e, index - b, partialPredicateCall)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -902,14 +915,14 @@ private module Impl {
|
||||
private Element getImmediateChildOfUnsafeBlock(
|
||||
UnsafeBlock e, int index, string partialPredicateCall
|
||||
) {
|
||||
exists(int b, int bBlock, int n |
|
||||
exists(int b, int bBlockBase, int n |
|
||||
b = 0 and
|
||||
bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and
|
||||
n = bBlock and
|
||||
bBlockBase = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlockBase(e, i, _)) | i) and
|
||||
n = bBlockBase and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfBlock(e, index - b, partialPredicateCall)
|
||||
result = getImmediateChildOfBlockBase(e, index - b, partialPredicateCall)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -1036,6 +1049,8 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfAsyncBlock(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfBlock(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfUnsafeBlock(e, index, partialAccessor)
|
||||
}
|
||||
}
|
||||
|
||||
31
rust/ql/lib/codeql/rust/generated/Raw.qll
generated
31
rust/ql/lib/codeql/rust/generated/Raw.qll
generated
@@ -201,21 +201,16 @@ module Raw {
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class Block extends @block, Expr {
|
||||
class BlockBase extends @block_base, Expr {
|
||||
/**
|
||||
* Gets the `index`th statement of this block (0-based).
|
||||
* Gets the `index`th statement of this block base (0-based).
|
||||
*/
|
||||
Stmt getStatement(int index) { block_statements(this, index, result) }
|
||||
Stmt getStatement(int index) { block_base_statements(this, index, result) }
|
||||
|
||||
/**
|
||||
* Gets the tail of this block, if it exists.
|
||||
* Gets the tail of this block base, if it exists.
|
||||
*/
|
||||
Expr getTail() { block_tails(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the label of this block, if it exists.
|
||||
*/
|
||||
string getLabel() { block_labels(this, result) }
|
||||
Expr getTail() { block_base_tails(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -863,14 +858,26 @@ module Raw {
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class AsyncBlock extends @async_block, Block {
|
||||
class AsyncBlock extends @async_block, BlockBase {
|
||||
override string toString() { result = "AsyncBlock" }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class UnsafeBlock extends @unsafe_block, Block {
|
||||
class Block extends @block, BlockBase {
|
||||
override string toString() { result = "Block" }
|
||||
|
||||
/**
|
||||
* Gets the label of this block, if it exists.
|
||||
*/
|
||||
string getLabel() { block_labels(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class UnsafeBlock extends @unsafe_block, BlockBase {
|
||||
override string toString() { result = "UnsafeBlock" }
|
||||
}
|
||||
}
|
||||
|
||||
38
rust/ql/lib/codeql/rust/generated/Synth.qll
generated
38
rust/ql/lib/codeql/rust/generated/Synth.qll
generated
@@ -39,6 +39,10 @@ module Synth {
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
TBindPat(Raw::BindPat id) { constructBindPat(id) } or
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
TBlock(Raw::Block id) { constructBlock(id) } or
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
@@ -260,7 +264,7 @@ module Synth {
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class TBlock = TAsyncBlock or TUnsafeBlock;
|
||||
class TBlockBase = TAsyncBlock or TBlock or TUnsafeBlock;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
@@ -271,7 +275,7 @@ module Synth {
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class TExpr =
|
||||
TArray or TAwait or TBecome or TBinaryOp or TBlock or TBox or TBreak or TCall or TCast or
|
||||
TArray or TAwait or TBecome or TBinaryOp or TBlockBase or TBox or TBreak or TCall or TCast or
|
||||
TClosure or TConst or TContinue or TField or TIf or TIndex or TInlineAsm or TLet or
|
||||
TLiteral or TLoop or TMatch or TMethodCall or TMissingExpr or TOffsetOf or TPath or
|
||||
TRange or TRecordLit or TRef or TReturn or TTuple or TUnaryOp or TUnderscore or TYeet or
|
||||
@@ -346,6 +350,13 @@ module Synth {
|
||||
cached
|
||||
TBindPat convertBindPatFromRaw(Raw::Element e) { result = TBindPat(e) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw element to a synthesized `TBlock`, if possible.
|
||||
*/
|
||||
cached
|
||||
TBlock convertBlockFromRaw(Raw::Element e) { result = TBlock(e) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw element to a synthesized `TBox`, if possible.
|
||||
@@ -738,12 +749,14 @@ module Synth {
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw DB element to a synthesized `TBlock`, if possible.
|
||||
* Converts a raw DB element to a synthesized `TBlockBase`, if possible.
|
||||
*/
|
||||
cached
|
||||
TBlock convertBlockFromRaw(Raw::Element e) {
|
||||
TBlockBase convertBlockBaseFromRaw(Raw::Element e) {
|
||||
result = convertAsyncBlockFromRaw(e)
|
||||
or
|
||||
result = convertBlockFromRaw(e)
|
||||
or
|
||||
result = convertUnsafeBlockFromRaw(e)
|
||||
}
|
||||
|
||||
@@ -785,7 +798,7 @@ module Synth {
|
||||
or
|
||||
result = convertBinaryOpFromRaw(e)
|
||||
or
|
||||
result = convertBlockFromRaw(e)
|
||||
result = convertBlockBaseFromRaw(e)
|
||||
or
|
||||
result = convertBoxFromRaw(e)
|
||||
or
|
||||
@@ -963,6 +976,13 @@ module Synth {
|
||||
cached
|
||||
Raw::Element convertBindPatToRaw(TBindPat e) { e = TBindPat(result) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TBlock` to a raw DB element, if possible.
|
||||
*/
|
||||
cached
|
||||
Raw::Element convertBlockToRaw(TBlock e) { e = TBlock(result) }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TBox` to a raw DB element, if possible.
|
||||
@@ -1355,12 +1375,14 @@ module Synth {
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TBlock` to a raw DB element, if possible.
|
||||
* Converts a synthesized `TBlockBase` to a raw DB element, if possible.
|
||||
*/
|
||||
cached
|
||||
Raw::Element convertBlockToRaw(TBlock e) {
|
||||
Raw::Element convertBlockBaseToRaw(TBlockBase e) {
|
||||
result = convertAsyncBlockToRaw(e)
|
||||
or
|
||||
result = convertBlockToRaw(e)
|
||||
or
|
||||
result = convertUnsafeBlockToRaw(e)
|
||||
}
|
||||
|
||||
@@ -1402,7 +1424,7 @@ module Synth {
|
||||
or
|
||||
result = convertBinaryOpToRaw(e)
|
||||
or
|
||||
result = convertBlockToRaw(e)
|
||||
result = convertBlockBaseToRaw(e)
|
||||
or
|
||||
result = convertBoxToRaw(e)
|
||||
or
|
||||
|
||||
@@ -9,6 +9,7 @@ import codeql.rust.elements.AwaitConstructor
|
||||
import codeql.rust.elements.BecomeConstructor
|
||||
import codeql.rust.elements.BinaryOpConstructor
|
||||
import codeql.rust.elements.BindPatConstructor
|
||||
import codeql.rust.elements.BlockConstructor
|
||||
import codeql.rust.elements.BoxConstructor
|
||||
import codeql.rust.elements.BoxPatConstructor
|
||||
import codeql.rust.elements.BreakConstructor
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
private import codeql.rust.generated.Synth
|
||||
private import codeql.rust.generated.Raw
|
||||
import codeql.rust.elements.Block
|
||||
import codeql.rust.elements.BlockBase
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `UnsafeBlock` and should not
|
||||
@@ -17,7 +17,7 @@ module Generated {
|
||||
* INTERNAL: Do not reference the `Generated::UnsafeBlock` class directly.
|
||||
* Use the subclass `UnsafeBlock`, where the following predicates are available.
|
||||
*/
|
||||
class UnsafeBlock extends Synth::TUnsafeBlock, Block {
|
||||
class UnsafeBlock extends Synth::TUnsafeBlock, BlockBase {
|
||||
override string getAPrimaryQlClass() { result = "UnsafeBlock" }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ db_locations(
|
||||
| @await
|
||||
| @become
|
||||
| @binary_op
|
||||
| @block
|
||||
| @block_base
|
||||
| @box
|
||||
| @break
|
||||
| @call
|
||||
@@ -185,30 +185,25 @@ bind_pat_subpats(
|
||||
int subpat: @pat ref
|
||||
);
|
||||
|
||||
@block =
|
||||
@block_base =
|
||||
@async_block
|
||||
| @block
|
||||
| @unsafe_block
|
||||
;
|
||||
|
||||
#keyset[id, index]
|
||||
block_statements(
|
||||
int id: @block ref,
|
||||
block_base_statements(
|
||||
int id: @block_base ref,
|
||||
int index: int ref,
|
||||
int statement: @stmt ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
block_tails(
|
||||
int id: @block ref,
|
||||
block_base_tails(
|
||||
int id: @block_base ref,
|
||||
int tail: @expr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
block_labels(
|
||||
int id: @block ref,
|
||||
string label: string ref
|
||||
);
|
||||
|
||||
boxes(
|
||||
unique int id: @box,
|
||||
int expr: @expr ref
|
||||
@@ -642,6 +637,16 @@ async_blocks(
|
||||
unique int id: @async_block
|
||||
);
|
||||
|
||||
blocks(
|
||||
unique int id: @block
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
block_labels(
|
||||
int id: @block ref,
|
||||
string label: string ref
|
||||
);
|
||||
|
||||
unsafe_blocks(
|
||||
unique int id: @unsafe_block
|
||||
);
|
||||
|
||||
@@ -138,9 +138,12 @@ class Let(Expr):
|
||||
# },
|
||||
|
||||
|
||||
class Block(Expr):
|
||||
class BlockBase(Expr):
|
||||
statements: list[Stmt]
|
||||
tail: optional[Expr]
|
||||
|
||||
|
||||
class Block(BlockBase):
|
||||
label: optional[string]
|
||||
|
||||
# Async {
|
||||
@@ -150,7 +153,7 @@ class Block(Expr):
|
||||
# },
|
||||
|
||||
|
||||
class AsyncBlock(Block):
|
||||
class AsyncBlock(BlockBase):
|
||||
pass
|
||||
|
||||
# Const(ConstBlockId),
|
||||
@@ -167,7 +170,7 @@ class Const(Expr):
|
||||
# },
|
||||
|
||||
|
||||
class UnsafeBlock(Block):
|
||||
class UnsafeBlock(BlockBase):
|
||||
pass
|
||||
|
||||
# Loop {
|
||||
|
||||
Reference in New Issue
Block a user