Rust: introduce PathExprBase class

This commit is contained in:
Arthur Baars 2024-10-23 18:25:55 +02:00
Родитель 2b65e78674
Коммит ca469f6d5c
18 изменённых файлов: 299 добавлений и 145 удалений

2
rust/extractor/src/generated/.generated.list сгенерированный
Просмотреть файл

@ -1,2 +1,2 @@
mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7
top.rs f7bff00786adef1f7f80825d9f613a958c92d35896ea8c3c3b077b9992dca590 f7bff00786adef1f7f80825d9f613a958c92d35896ea8c3c3b077b9992dca590
top.rs a77ab900964451c668839aad6827ea539b8932e7c93b54a7987ece0e1bd846ba a77ab900964451c668839aad6827ea539b8932e7c93b54a7987ece0e1bd846ba

122
rust/extractor/src/generated/top.rs сгенерированный
Просмотреть файл

@ -6232,62 +6232,44 @@ impl From<trap::Label<ParenType>> for trap::Label<TypeRef> {
}
#[derive(Debug)]
pub struct PathExpr {
pub id: trap::TrapId<PathExpr>,
pub attrs: Vec<trap::Label<Attr>>,
pub path: Option<trap::Label<Path>>,
pub struct PathExprBase {
_unused: ()
}
impl trap::TrapEntry for PathExpr {
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("path_exprs", vec![id.into()]);
for (i, v) in self.attrs.into_iter().enumerate() {
out.add_tuple("path_expr_attrs", vec![id.into(), i.into(), v.into()]);
}
if let Some(v) = self.path {
out.add_tuple("path_expr_paths", vec![id.into(), v.into()]);
}
}
impl trap::TrapClass for PathExprBase {
fn class_name() -> &'static str { "PathExprBase" }
}
impl trap::TrapClass for PathExpr {
fn class_name() -> &'static str { "PathExpr" }
}
impl From<trap::Label<PathExpr>> for trap::Label<AstNode> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of AstNode
impl From<trap::Label<PathExprBase>> for trap::Label<AstNode> {
fn from(value: trap::Label<PathExprBase>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExprBase is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathExpr>> for trap::Label<Element> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Element
impl From<trap::Label<PathExprBase>> for trap::Label<Element> {
fn from(value: trap::Label<PathExprBase>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExprBase is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathExpr>> for trap::Label<Expr> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Expr
impl From<trap::Label<PathExprBase>> for trap::Label<Expr> {
fn from(value: trap::Label<PathExprBase>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExprBase is a subclass of Expr
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathExpr>> for trap::Label<Locatable> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Locatable
impl From<trap::Label<PathExprBase>> for trap::Label<Locatable> {
fn from(value: trap::Label<PathExprBase>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExprBase is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
@ -9225,6 +9207,78 @@ impl From<trap::Label<Module>> for trap::Label<Stmt> {
}
}
#[derive(Debug)]
pub struct PathExpr {
pub id: trap::TrapId<PathExpr>,
pub attrs: Vec<trap::Label<Attr>>,
pub path: Option<trap::Label<Path>>,
}
impl trap::TrapEntry for PathExpr {
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("path_exprs", vec![id.into()]);
for (i, v) in self.attrs.into_iter().enumerate() {
out.add_tuple("path_expr_attrs", vec![id.into(), i.into(), v.into()]);
}
if let Some(v) = self.path {
out.add_tuple("path_expr_paths", vec![id.into(), v.into()]);
}
}
}
impl trap::TrapClass for PathExpr {
fn class_name() -> &'static str { "PathExpr" }
}
impl From<trap::Label<PathExpr>> for trap::Label<AstNode> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathExpr>> for trap::Label<Element> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathExpr>> for trap::Label<Expr> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Expr
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathExpr>> for trap::Label<Locatable> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathExpr>> for trap::Label<PathExprBase> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of PathExprBase
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct Static {
pub id: trap::TrapId<Static>,

19
rust/ql/.generated.list сгенерированный
Просмотреть файл

@ -44,7 +44,7 @@ lib/codeql/rust/elements/Format.qll 506172d176f4b965f428585c032464f4abe07a0e47c5
lib/codeql/rust/elements/FormatArgsArg.qll 5bc9b4cd1bac7131165836e93838c45452a08ea6011741cbddace3cbf9c69440 f825140e98dc9800d5c045402186793c7b21511448e2f6bf6402d1e06305219c
lib/codeql/rust/elements/FormatArgsExpr.qll f2ffad5a1105b29a8437c8ed6cf918cfcf4d65ac164bbf1be0585c3b673ca749 3ba20dc312a0a994bb43b37b2db72cbd4e06061b97918fa0e84ce355070ffbeb
lib/codeql/rust/elements/FormatArgument.qll bdd93e1da78637f19beee6f953d3a45512100e925d90cb5ad08a097f412009b8 2a0ae7eb885615e380f925c0d130a1b795bf3c395486550a1f1c9c82848f8d77
lib/codeql/rust/elements/FormatTemplateVariableAccess.qll a470b8cc10be45f2cfdc3ad38bc3f2e1edf88ec531a9b7323d7b8b72ee2d949d d6f2152687daa06fa4b8d2012e530218bc84144e98676ea19334c0e593271b91
lib/codeql/rust/elements/FormatTemplateVariableAccess.qll ff3218a1dda30c232d0ecd9d1c60bbb9f3973456ef0bee1d1a12ad14b1e082b5 e4316291c939800d8b34d477d92be9404a30d52b7eee37302aef3d3205cf4ae0
lib/codeql/rust/elements/Function.qll 2c76c2c7036891996b1f0ebde16c414edf37ebb44ff9c3483088dc6218733e07 d84d017d98aa240bf3bee6502a030aa8cfb7ed95425ffa9853e73b41485e1f4a
lib/codeql/rust/elements/GenericArg.qll 5f11ce0e3c5f08de84db61f56ba1b984652455ba6b95a8b8a5b5a235913d4072 756b6a73d66fde45bdcc65ce2362a5b1391af2927e6d54b6550b3ecd5fd11e75
lib/codeql/rust/elements/GenericArgList.qll dcf274db517b0e8f19e4545d77f86cdd4066ff2805e68c808d0bb5750b49f569 1055a82929e850264e501b367ef4d314a3e6bb8943ec95f4284d157fb4d0092f
@ -97,7 +97,8 @@ lib/codeql/rust/elements/ParenPat.qll 40d033de6c85ad042223e0da80479adebab3549439
lib/codeql/rust/elements/ParenType.qll e1f5695b143c97b98ccdb460a5cf872461cfc13b83a4f005f26c288dc0afae10 1164f8efae7f255925411bddb33939fab0bf1c07955a16fef173b3f4675d09ae
lib/codeql/rust/elements/Pat.qll 56211c5cb4709e7c12a2bfd2da5e413a451672d99e23a8386c08ad0b999fd45c b1b1893a13a75c4f0390f7e2a14ee98a46f067cfdc991a8d43adc82497d20aff
lib/codeql/rust/elements/Path.qll 0655adfe84b08c286022a0307511a781bc1bfc943c12bc50600ebffb9d00e4b0 48e55afee9d019b7c62bfb02110c626c570ecbf683258cf23786807966f0b6fc
lib/codeql/rust/elements/PathExpr.qll 99aa8af9deb9e276eb262b1fbd1a19f1c816cafac605aedb173ecb245c3c3cbd 306c837388ba60a5a89d2a546453527c62006696e15c043ed04d1ba27345815b
lib/codeql/rust/elements/PathExpr.qll 906df1d80c662b79f1b0b0428c39754b7f8dbcb2234919dd45dd8206a099dd36 1d6015afab6378c926c5838c9a5772cfcfeedf474e2eeca3e46085300ff8d4e1
lib/codeql/rust/elements/PathExprBase.qll bb41092ec690ae926e3233c215dcaf1fd8e161b8a6955151949f492e02dba13a b2257072f8062d31c29c63ee1311b07e0d2eb37075f582cfc76bb542ef773198
lib/codeql/rust/elements/PathPat.qll 6897e69bcb24b56d39ede796cf5767988dcd5741e02333fa8495dd7c814f771a 2a011fb92f17e4b4ff713e6d29f591054dfede22a9aaa006e67fca2c23ab76bf
lib/codeql/rust/elements/PathSegment.qll 536a8fe172db367e5f1dc678a014e2350eadfc379242d2b5451725e826ab1448 1a3a237f56c1d9ccdce6832ec6417fed25cd3e29ba836363cc6085e2125de4c5
lib/codeql/rust/elements/PathType.qll a7bd3b05dc2c0e96c91c5485db508a1f5bb8fe3a01486be6815ae9dabb163add b11e996b6c0cc21a3d8d1ddc23c37e4d54a78e84a9278b3ceca1e94cb7321532
@ -327,6 +328,7 @@ lib/codeql/rust/elements/internal/ParenTypeConstructor.qll d62e656a4a3c8ffd4eb87
lib/codeql/rust/elements/internal/ParenTypeImpl.qll 6f7b4fade4ac0af69bf9766ee7d73da3da1742ba8a7c12d2a067b71c7f96d849 f065ea466111a5abca33d97b9878ef2fcc221f286fc65bec87f3a9c2fd5d57fc
lib/codeql/rust/elements/internal/PatImpl.qll 37c9b1da7aa625117644e2cd74ec0b174f69a38cf66926add01786a05d5ad2ad 143685a0b4873fa0b73b204285dca956e59b32d527bfac6cc336326d244994b7
lib/codeql/rust/elements/internal/PathConstructor.qll 5c6354c28faf9f28f3efee8e19bdb82773adcf4b0c1a38788b06af25bcb6bc4a 3e2aeef7b6b9cda7f7f45a6c8119c98803aa644cf6a492cf0fce318eba40fe8f
lib/codeql/rust/elements/internal/PathExprBaseImpl.qll e8b09447ee41b4123f7d94c6b366b2602d8022c9644f1088c670c7794307ab2e 96b9b328771aaf19ba18d0591e85fcc915c0f930b2479b433de3bfdd2ea25249
lib/codeql/rust/elements/internal/PathExprConstructor.qll cf6e0a338a8ed2d1042bdee4c2c49be5827e8c572d8c56e828db265d39e59ae3 36a3d1b7c5cc2cf527616be787b32071b9e2a6613a4f6b3f82e2a3b0e02a516f
lib/codeql/rust/elements/internal/PathExprImpl.qll 01ad25aa940bf949056db86220362f0f5a1b03a772af6a2f6aff8854170c5e49 a0f5ff6b04e2f9f22bda78bb2a7352d890899ba16cb7f6a267af902a3650c5ed
lib/codeql/rust/elements/internal/PathImpl.qll 67ccef5792c0d17d800b910cbda3651aaa5c0ba8daa64e1fea23a1518b562193 6a54b958f7206c43565889a273a64b95aa4b915044a986ffffe7cfb4b8f9c3a9
@ -499,7 +501,7 @@ lib/codeql/rust/elements/internal/generated/Format.qll 37ad20cf2bf363b4027a8913d
lib/codeql/rust/elements/internal/generated/FormatArgsArg.qll e07a1ae310f590003f1b88fada7dcf4847c99adb9d4c838d1c88e66e1da85c5f 0ef7342451fe2cb06e765fb4b33bb8c4a9b927f5edbc8feb5c6ba3655697f447
lib/codeql/rust/elements/internal/generated/FormatArgsExpr.qll 40d6daa7d2bafb33798a21d79774dc802cfbd7a31618ac3bd0149399ea2bf893 d1172e2151791228559004792e125fc4625f6a26ffad25f29efb0ad263bf8795
lib/codeql/rust/elements/internal/generated/FormatArgument.qll 00646f38217a66978b8b2648cca39dddbed22ece693b26cb682f019fbfedda95 e364e085f967847a7ed21b76156a9203d64032f0f0eea357b4779885a41bf9a7
lib/codeql/rust/elements/internal/generated/FormatTemplateVariableAccess.qll 385158a2958452d56f74504b309e81390241991694a9023f5ec2b5df3cd75543 fb12f06130006aa78cce4ca8fdd0d298990267ee0db289ea0ebf1d94a8ccef43
lib/codeql/rust/elements/internal/generated/FormatTemplateVariableAccess.qll a6175214fad445df9234b3ee9bf5147da75baf82473fb8d384b455e3add0dac1 a928db0ff126b2e54a18f5c488232abd1bd6c5eda24591d3c3bb80c6ee71c770
lib/codeql/rust/elements/internal/generated/Function.qll f285ee0c771f897eba6db34a7e98f3cfb7db91b0df252ff4b37fc9d779de0bfb 07401e832565ff376acda219514c2e2bbe4ae5058c76a73b40ca6ca66f1626c7
lib/codeql/rust/elements/internal/generated/GenericArg.qll 464da0ba1c5ddcd1be68617167f177773d99b5ac4775ec8ea24d503e789a9099 6faa1033d59baf7c210ac4837a55781cfc054b7acbad8027faf4630dbfa6e101
lib/codeql/rust/elements/internal/generated/GenericArgList.qll b8cd936bba6f28344e28c98acf38acb8ef43af6ecf8367d79ed487e5b9da17cb 8b14331261e49d004807285b02fca190aafd62bfb9378b05c7d9c1e95525fe7b
@ -550,10 +552,11 @@ lib/codeql/rust/elements/internal/generated/ParamList.qll c808c9d84dd7800573832b
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 2c45ff4f645ec91ffe3bf2d726b478cb8bf959f26c14f0d56cacf21c0e4b153b 981485f9899afdf531eff63ae42fc202d257e00b04465c8792457d23b584faeb
lib/codeql/rust/elements/internal/generated/ParentChild.qll 611eff5fe700323eba2dbee6f9495952059e77c3ec12038c9d45d2cdaa57efd5 f317538e9919e39dfbf3825a96231f8023568f2d4c61d814c4cebaaf8335f94c
lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4
lib/codeql/rust/elements/internal/generated/Path.qll 299abce24762a5ab023f3cf1ab9718b83047e171aed42a8092e7a155914b1657 db1a23d18640c548f08c9f94823838b5e019ac85877c7b15df2d1493d1846572
lib/codeql/rust/elements/internal/generated/PathExpr.qll 17cdb0a7393258a207450f08e37178fc9d35d167f064ba6015be94246f3dc933 a75fdd280aff6d87e083a92030e041c2eb52b57cf7151d4a6989fcd31d6a64bf
lib/codeql/rust/elements/internal/generated/PathExpr.qll 2096e3c1db22ee488a761690adabfc9cfdea501c99f7c5d96c0019cb113fc506 54245ce0449c4e263173213df01e079d5168a758503a5dbd61b25ad35a311140
lib/codeql/rust/elements/internal/generated/PathExprBase.qll d8218e201b8557fa6d9ca2c30b764e5ad9a04a2e4fb695cc7219bbd7636a6ac2 4ef178426d7095a156f4f8c459b4d16f63abc64336cb50a6cf883a5f7ee09113
lib/codeql/rust/elements/internal/generated/PathPat.qll 98c9938d6a359fd717829b196eb09701d2c798e18c1f43fa7b2a9145afdf6c19 caba2e629cae08682baac90a76ae9a48cda2d7d6f9c23d506fa0ff3f292978a4
lib/codeql/rust/elements/internal/generated/PathSegment.qll 4621597fd86246f788b8f9ca73f6b0f27929fc04261ce3ccf85da1183071431d aadda8bce386a3b7a9c53b98465eedcc4f724e37b8a904c1775af5b7ffb041ee
lib/codeql/rust/elements/internal/generated/PathType.qll 45de78e5374d6eb0446e2112ec72d3692c2811df9fa2ad03d0127e426940abe3 622cf70408413a565a0dac58f451035ac1339c8d0ee5b24f630680201cb0aa48
@ -562,7 +565,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 429057964308876b8186a0ca901634273d91b783e4bb85aa5e47860010f4da0b feb8231d0b724fedb1d9d2a65d4a8759ae58baec902b44e3bebdb81a7fbc1fd1
lib/codeql/rust/elements/internal/generated/Raw.qll 6ce0e8a0d2922b2484d48108ffafb1daf6312103e3b8b190774a7a6f12c73ab3 e90268b1865f7e9a671f8bcff3812bf9c0b75baf573a031395747269dfe054c8
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
@ -587,7 +590,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 521c9180f37ae5a7d5798c4b353b9ce04a0d2ce1a83440c34955f12e3e31f0ed 880fbb1dd673c2f64e9404f79cb62691d7778faa7618f7302e566112b54f08c3
lib/codeql/rust/elements/internal/generated/Synth.qll 68126fecadf402b76a30b6e916b1d1c15db1b06c48a401267bf59ac06aaa5ec3 545f3fa49591cf9a11b9bf6d9c860726db31dffe43be8c96ac3f2cac8d47c010
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
@ -622,7 +625,7 @@ lib/codeql/rust/elements/internal/generated/WhileExpr.qll fec8a9211b82a80601bf73
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 ea1f5024fc6bde4845a0e390f7c59a2366deb2dc287e6f05cee96167fbe91754 ea1f5024fc6bde4845a0e390f7c59a2366deb2dc287e6f05cee96167fbe91754
lib/codeql/rust/elements.qll 6dc44d60d8180da23e7df8815adafa506936c7704723df0592bd1c6c60280abe 6dc44d60d8180da23e7df8815adafa506936c7704723df0592bd1c6c60280abe
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

3
rust/ql/.gitattributes сгенерированный поставляемый
Просмотреть файл

@ -100,6 +100,7 @@
/lib/codeql/rust/elements/Pat.qll linguist-generated
/lib/codeql/rust/elements/Path.qll linguist-generated
/lib/codeql/rust/elements/PathExpr.qll linguist-generated
/lib/codeql/rust/elements/PathExprBase.qll linguist-generated
/lib/codeql/rust/elements/PathPat.qll linguist-generated
/lib/codeql/rust/elements/PathSegment.qll linguist-generated
/lib/codeql/rust/elements/PathType.qll linguist-generated
@ -329,6 +330,7 @@
/lib/codeql/rust/elements/internal/ParenTypeImpl.qll linguist-generated
/lib/codeql/rust/elements/internal/PatImpl.qll linguist-generated
/lib/codeql/rust/elements/internal/PathConstructor.qll linguist-generated
/lib/codeql/rust/elements/internal/PathExprBaseImpl.qll linguist-generated
/lib/codeql/rust/elements/internal/PathExprConstructor.qll linguist-generated
/lib/codeql/rust/elements/internal/PathExprImpl.qll linguist-generated
/lib/codeql/rust/elements/internal/PathImpl.qll linguist-generated
@ -556,6 +558,7 @@
/lib/codeql/rust/elements/internal/generated/Pat.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/Path.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/PathExpr.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/PathExprBase.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/PathPat.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/PathSegment.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/PathType.qll linguist-generated

1
rust/ql/lib/codeql/rust/elements.qll сгенерированный
Просмотреть файл

@ -103,6 +103,7 @@ import codeql.rust.elements.ParenType
import codeql.rust.elements.Pat
import codeql.rust.elements.Path
import codeql.rust.elements.PathExpr
import codeql.rust.elements.PathExprBase
import codeql.rust.elements.PathPat
import codeql.rust.elements.PathSegment
import codeql.rust.elements.PathType

Просмотреть файл

@ -4,6 +4,6 @@
*/
private import internal.FormatTemplateVariableAccessImpl
import codeql.rust.elements.Expr
import codeql.rust.elements.PathExprBase
final class FormatTemplateVariableAccess = Impl::FormatTemplateVariableAccess;

2
rust/ql/lib/codeql/rust/elements/PathExpr.qll сгенерированный
Просмотреть файл

@ -5,8 +5,8 @@
private import internal.PathExprImpl
import codeql.rust.elements.Attr
import codeql.rust.elements.Expr
import codeql.rust.elements.Path
import codeql.rust.elements.PathExprBase
/**
* A path expression. For example:

12
rust/ql/lib/codeql/rust/elements/PathExprBase.qll сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,12 @@
// generated by codegen, do not edit
/**
* This module provides the public class `PathExprBase`.
*/
private import internal.PathExprBaseImpl
import codeql.rust.elements.Expr
/**
* A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.
*/
final class PathExprBase = Impl::PathExprBase;

19
rust/ql/lib/codeql/rust/elements/internal/PathExprBaseImpl.qll сгенерированный 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 `PathExprBase`.
*
* INTERNAL: Do not use.
*/
private import codeql.rust.elements.internal.generated.PathExprBase
/**
* INTERNAL: This module contains the customizable definition of `PathExprBase` and should not
* be referenced directly.
*/
module Impl {
/**
* A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.
*/
class PathExprBase extends Generated::PathExprBase { }
}

Просмотреть файл

@ -1,7 +1,6 @@
private import rust
private import codeql.rust.elements.internal.generated.ParentChild
private import codeql.rust.elements.internal.ExprImpl::Impl as ExprImpl
private import codeql.rust.elements.internal.PathExprImpl::Impl as PathExprImpl
private import codeql.rust.elements.internal.PathExprBaseImpl::Impl as PathExprBaseImpl
private import codeql.rust.elements.internal.FormatTemplateVariableAccessImpl::Impl as FormatTemplateVariableAccessImpl
private import codeql.util.DenseRank
@ -140,7 +139,7 @@ module Impl {
}
/** A path expression that may access a local variable. */
private class VariableAccessCand extends TVariableAccess {
private class VariableAccessCand extends PathExprBase {
string name_;
VariableAccessCand() {
@ -448,10 +447,8 @@ module Impl {
private import codeql.rust.elements.internal.generated.Synth
private class TVariableAccess = Synth::TPathExpr or Synth::TFormatTemplateVariableAccess;
/** A variable access. */
abstract class VariableAccess extends ExprImpl::Expr, TVariableAccess instanceof VariableAccessCand
abstract class VariableAccess extends PathExprBaseImpl::PathExprBase instanceof VariableAccessCand
{
private string name;
private Variable v;
@ -469,18 +466,6 @@ module Impl {
override string getAPrimaryQlClass() { result = "VariableAccess" }
}
private class VariableAccessPathExpr extends VariableAccess, PathExprImpl::PathExpr {
override string getAPrimaryQlClass() { result = VariableAccess.super.getAPrimaryQlClass() }
}
private class VariableAccessFormatTemplateVariableAccess extends VariableAccess,
FormatTemplateVariableAccessImpl::FormatTemplateVariableAccess
{
override string toString() { result = VariableAccess.super.toString() }
override string getAPrimaryQlClass() { result = VariableAccess.super.getAPrimaryQlClass() }
}
/** Holds if `e` occurs in the LHS of an assignment or compound assignment. */
private predicate assignmentExprDescendant(Expr e) {
e = any(AssignmentExpr ae).getLhs()

Просмотреть файл

@ -6,7 +6,7 @@
private import codeql.rust.elements.internal.generated.Synth
private import codeql.rust.elements.internal.generated.Raw
import codeql.rust.elements.internal.ExprImpl::Impl as ExprImpl
import codeql.rust.elements.internal.PathExprBaseImpl::Impl as PathExprBaseImpl
/**
* INTERNAL: This module contains the fully generated definition of `FormatTemplateVariableAccess` and should not
@ -17,7 +17,9 @@ module Generated {
* INTERNAL: Do not reference the `Generated::FormatTemplateVariableAccess` class directly.
* Use the subclass `FormatTemplateVariableAccess`, where the following predicates are available.
*/
class FormatTemplateVariableAccess extends Synth::TFormatTemplateVariableAccess, ExprImpl::Expr {
class FormatTemplateVariableAccess extends Synth::TFormatTemplateVariableAccess,
PathExprBaseImpl::PathExprBase
{
override string getAPrimaryQlClass() { result = "FormatTemplateVariableAccess" }
}
}

Просмотреть файл

@ -1790,21 +1790,6 @@ private module Impl {
)
}
private Element getImmediateChildOfFormatTemplateVariableAccess(
FormatTemplateVariableAccess 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
n = bExpr and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfIdentPat(IdentPat e, int index, string partialPredicateCall) {
exists(int b, int bPat, int n, int nAttr, int nName, int nPat |
b = 0 and
@ -2257,22 +2242,17 @@ private module Impl {
)
}
private Element getImmediateChildOfPathExpr(PathExpr e, int index, string partialPredicateCall) {
exists(int b, int bExpr, int n, int nAttr, int nPath |
private Element getImmediateChildOfPathExprBase(
PathExprBase 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
n = bExpr and
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
nPath = nAttr + 1 and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
or
result = e.getAttr(index - n) and
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
or
index = nAttr and result = e.getPath() and partialPredicateCall = "Path()"
)
)
}
@ -2983,6 +2963,22 @@ private module Impl {
)
}
private Element getImmediateChildOfFormatTemplateVariableAccess(
FormatTemplateVariableAccess e, int index, string partialPredicateCall
) {
exists(int b, int bPathExprBase, int n |
b = 0 and
bPathExprBase =
b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPathExprBase(e, i, _)) | i) and
n = bPathExprBase and
(
none()
or
result = getImmediateChildOfPathExprBase(e, index - b, partialPredicateCall)
)
)
}
private Element getImmediateChildOfFunction(Function e, int index, string partialPredicateCall) {
exists(
int b, int bAssocItem, int bExternItem, int bItem, int bCallable, int n, int nAbi, int nBody,
@ -3219,6 +3215,27 @@ private module Impl {
)
}
private Element getImmediateChildOfPathExpr(PathExpr e, int index, string partialPredicateCall) {
exists(int b, int bPathExprBase, int n, int nAttr, int nPath |
b = 0 and
bPathExprBase =
b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPathExprBase(e, i, _)) | i) and
n = bPathExprBase and
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
nPath = nAttr + 1 and
(
none()
or
result = getImmediateChildOfPathExprBase(e, index - b, partialPredicateCall)
or
result = e.getAttr(index - n) and
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
or
index = nAttr and result = e.getPath() and partialPredicateCall = "Path()"
)
)
}
private Element getImmediateChildOfStatic(Static e, int index, string partialPredicateCall) {
exists(
int b, int bExternItem, int bItem, int n, int nAttr, int nBody, int nName, int nTy,
@ -3652,8 +3669,6 @@ private module Impl {
or
result = getImmediateChildOfFormatArgsExpr(e, index, partialAccessor)
or
result = getImmediateChildOfFormatTemplateVariableAccess(e, index, partialAccessor)
or
result = getImmediateChildOfIdentPat(e, index, partialAccessor)
or
result = getImmediateChildOfIfExpr(e, index, partialAccessor)
@ -3698,8 +3713,6 @@ private module Impl {
or
result = getImmediateChildOfParenType(e, index, partialAccessor)
or
result = getImmediateChildOfPathExpr(e, index, partialAccessor)
or
result = getImmediateChildOfPathPat(e, index, partialAccessor)
or
result = getImmediateChildOfPathType(e, index, partialAccessor)
@ -3768,6 +3781,8 @@ private module Impl {
or
result = getImmediateChildOfExternCrate(e, index, partialAccessor)
or
result = getImmediateChildOfFormatTemplateVariableAccess(e, index, partialAccessor)
or
result = getImmediateChildOfFunction(e, index, partialAccessor)
or
result = getImmediateChildOfImpl(e, index, partialAccessor)
@ -3782,6 +3797,8 @@ private module Impl {
or
result = getImmediateChildOfModule(e, index, partialAccessor)
or
result = getImmediateChildOfPathExpr(e, index, partialAccessor)
or
result = getImmediateChildOfStatic(e, index, partialAccessor)
or
result = getImmediateChildOfStruct(e, index, partialAccessor)

Просмотреть файл

@ -7,8 +7,8 @@
private import codeql.rust.elements.internal.generated.Synth
private import codeql.rust.elements.internal.generated.Raw
import codeql.rust.elements.Attr
import codeql.rust.elements.internal.ExprImpl::Impl as ExprImpl
import codeql.rust.elements.Path
import codeql.rust.elements.internal.PathExprBaseImpl::Impl as PathExprBaseImpl
/**
* INTERNAL: This module contains the fully generated definition of `PathExpr` and should not
@ -26,7 +26,7 @@ module Generated {
* INTERNAL: Do not reference the `Generated::PathExpr` class directly.
* Use the subclass `PathExpr`, where the following predicates are available.
*/
class PathExpr extends Synth::TPathExpr, ExprImpl::Expr {
class PathExpr extends Synth::TPathExpr, PathExprBaseImpl::PathExprBase {
override string getAPrimaryQlClass() { result = "PathExpr" }
/**

22
rust/ql/lib/codeql/rust/elements/internal/generated/PathExprBase.qll сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,22 @@
// generated by codegen, do not edit
/**
* This module provides the generated definition of `PathExprBase`.
* 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.ExprImpl::Impl as ExprImpl
/**
* INTERNAL: This module contains the fully generated definition of `PathExprBase` and should not
* be referenced directly.
*/
module Generated {
/**
* A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.
* INTERNAL: Do not reference the `Generated::PathExprBase` class directly.
* Use the subclass `PathExprBase`, where the following predicates are available.
*/
class PathExprBase extends Synth::TPathExprBase, ExprImpl::Expr { }
}

Просмотреть файл

@ -2460,27 +2460,9 @@ module Raw {
/**
* INTERNAL: Do not use.
* A path expression. For example:
* ```rust
* let x = variable;
* let x = foo::bar;
* let y = <T>::foo;
* let z = <TypeRef as Trait>::foo;
* ```
* A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.
*/
class PathExpr extends @path_expr, Expr {
override string toString() { result = "PathExpr" }
/**
* Gets the `index`th attr of this path expression (0-based).
*/
Attr getAttr(int index) { path_expr_attrs(this, index, result) }
/**
* Gets the path of this path expression, if it exists.
*/
Path getPath() { path_expr_paths(this, result) }
}
class PathExprBase extends @path_expr_base, Expr { }
/**
* INTERNAL: Do not use.
@ -3608,6 +3590,30 @@ module Raw {
Visibility getVisibility() { module_visibilities(this, result) }
}
/**
* INTERNAL: Do not use.
* A path expression. For example:
* ```rust
* let x = variable;
* let x = foo::bar;
* let y = <T>::foo;
* let z = <TypeRef as Trait>::foo;
* ```
*/
class PathExpr extends @path_expr, PathExprBase {
override string toString() { result = "PathExpr" }
/**
* Gets the `index`th attr of this path expression (0-based).
*/
Attr getAttr(int index) { path_expr_attrs(this, index, result) }
/**
* Gets the path of this path expression, if it exists.
*/
Path getPath() { path_expr_paths(this, result) }
}
/**
* INTERNAL: Do not use.
* A Static. For example:

Просмотреть файл

@ -647,11 +647,10 @@ module Synth {
class TExpr =
TArrayExpr or TAsmExpr or TAwaitExpr or TBecomeExpr or TBinaryExpr or TBlockExpr or
TBreakExpr or TCallExprBase or TCastExpr or TClosureExpr or TContinueExpr or TFieldExpr or
TForExpr or TFormatArgsExpr or TFormatTemplateVariableAccess or TIfExpr or TIndexExpr or
TLetExpr or TLiteralExpr or TLoopExpr or TMacroExpr or TMatchExpr or TOffsetOfExpr or
TParenExpr or TPathExpr or TPrefixExpr or TRangeExpr or TRecordExpr or TRefExpr or
TReturnExpr or TTryExpr or TTupleExpr or TUnderscoreExpr or TWhileExpr or TYeetExpr or
TYieldExpr;
TForExpr or TFormatArgsExpr or TIfExpr or TIndexExpr or TLetExpr or TLiteralExpr or
TLoopExpr or TMacroExpr or TMatchExpr or TOffsetOfExpr or TParenExpr or TPathExprBase or
TPrefixExpr or TRangeExpr or TRecordExpr or TRefExpr or TReturnExpr or TTryExpr or
TTupleExpr or TUnderscoreExpr or TWhileExpr or TYeetExpr or TYieldExpr;
/**
* INTERNAL: Do not use.
@ -694,6 +693,11 @@ module Synth {
TPathPat or TRangePat or TRecordPat or TRefPat or TRestPat or TSlicePat or TTuplePat or
TTupleStructPat or TWildcardPat;
/**
* INTERNAL: Do not use.
*/
class TPathExprBase = TFormatTemplateVariableAccess or TPathExpr;
/**
* INTERNAL: Do not use.
*/
@ -1804,8 +1808,6 @@ module Synth {
or
result = convertFormatArgsExprFromRaw(e)
or
result = convertFormatTemplateVariableAccessFromRaw(e)
or
result = convertIfExprFromRaw(e)
or
result = convertIndexExprFromRaw(e)
@ -1824,7 +1826,7 @@ module Synth {
or
result = convertParenExprFromRaw(e)
or
result = convertPathExprFromRaw(e)
result = convertPathExprBaseFromRaw(e)
or
result = convertPrefixExprFromRaw(e)
or
@ -1989,6 +1991,16 @@ module Synth {
result = convertWildcardPatFromRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a raw DB element to a synthesized `TPathExprBase`, if possible.
*/
TPathExprBase convertPathExprBaseFromRaw(Raw::Element e) {
result = convertFormatTemplateVariableAccessFromRaw(e)
or
result = convertPathExprFromRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a raw DB element to a synthesized `TStmt`, if possible.
@ -3136,8 +3148,6 @@ module Synth {
or
result = convertFormatArgsExprToRaw(e)
or
result = convertFormatTemplateVariableAccessToRaw(e)
or
result = convertIfExprToRaw(e)
or
result = convertIndexExprToRaw(e)
@ -3156,7 +3166,7 @@ module Synth {
or
result = convertParenExprToRaw(e)
or
result = convertPathExprToRaw(e)
result = convertPathExprBaseToRaw(e)
or
result = convertPrefixExprToRaw(e)
or
@ -3321,6 +3331,16 @@ module Synth {
result = convertWildcardPatToRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a synthesized `TPathExprBase` to a raw DB element, if possible.
*/
Raw::Element convertPathExprBaseToRaw(TPathExprBase e) {
result = convertFormatTemplateVariableAccessToRaw(e)
or
result = convertPathExprToRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a synthesized `TStmt` to a raw DB element, if possible.

Просмотреть файл

@ -310,7 +310,7 @@ closure_binder_generic_param_lists(
| @match_expr
| @offset_of_expr
| @paren_expr
| @path_expr
| @path_expr_base
| @prefix_expr
| @range_expr
| @record_expr
@ -2113,22 +2113,9 @@ paren_type_ties(
int ty: @type_ref ref
);
path_exprs(
unique int id: @path_expr
);
#keyset[id, index]
path_expr_attrs(
int id: @path_expr ref,
int index: int ref,
int attr: @attr ref
);
#keyset[id]
path_expr_paths(
int id: @path_expr ref,
int path: @path ref
);
@path_expr_base =
@path_expr
;
path_pats(
unique int id: @path_pat
@ -3036,6 +3023,23 @@ module_visibilities(
int visibility: @visibility ref
);
path_exprs(
unique int id: @path_expr
);
#keyset[id, index]
path_expr_attrs(
int id: @path_expr ref,
int index: int ref,
int attr: @attr ref
);
#keyset[id]
path_expr_paths(
int id: @path_expr ref,
int path: @path ref
);
statics(
unique int id: @static
);

Просмотреть файл

@ -101,7 +101,13 @@ class _:
"""
@annotate(PathExpr)
class PathExprBase(Expr):
"""
A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.
"""
@annotate(PathExpr, replace_bases={Expr: PathExprBase})
class _:
"""
A path expression. For example:
@ -1758,7 +1764,7 @@ class _:
@qltest.skip
@synth.on_arguments(parent="FormatArgsExpr", index=int, kind=int)
class FormatTemplateVariableAccess(Expr):
class FormatTemplateVariableAccess(PathExprBase):
pass