diff --git a/rust/ql/.generated.list b/rust/ql/.generated.list index 4db40d43f2f0..75e48272e9b4 100644 --- a/rust/ql/.generated.list +++ b/rust/ql/.generated.list @@ -44,6 +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/Function.qll 2c76c2c7036891996b1f0ebde16c414edf37ebb44ff9c3483088dc6218733e07 d84d017d98aa240bf3bee6502a030aa8cfb7ed95425ffa9853e73b41485e1f4a lib/codeql/rust/elements/GenericArg.qll 5f11ce0e3c5f08de84db61f56ba1b984652455ba6b95a8b8a5b5a235913d4072 756b6a73d66fde45bdcc65ce2362a5b1391af2927e6d54b6550b3ecd5fd11e75 lib/codeql/rust/elements/GenericArgList.qll dcf274db517b0e8f19e4545d77f86cdd4066ff2805e68c808d0bb5750b49f569 1055a82929e850264e501b367ef4d314a3e6bb8943ec95f4284d157fb4d0092f @@ -53,7 +54,6 @@ lib/codeql/rust/elements/IdentPat.qll ad5f202316d4eeee3ca81ea445728f4ad7eb6bb7d8 lib/codeql/rust/elements/IfExpr.qll f62153e8098b3eb08b569d4e25c750bc686665651579db4bc9e11dcef8e75d63 55006a55d612f189e73caa02f7b4deda388c692f0a801cdda9f833f2afdca778 lib/codeql/rust/elements/Impl.qll 9593c47af4fa08afb19c52aab7d0bac6740fed7ec60201f47e7bc46f13bfb329 4ec840401563ab6136b99491b881c9a10108240de972b19ec64227e1e7d73e65 lib/codeql/rust/elements/ImplTraitType.qll f7241044f6666a509cfbc01bf6df3db5360e67dd0f9baba4a323566701359203 350636d0b1c7a77e006170cbfa9108c259dd5831b0f242da76c10be3ecc32870 -lib/codeql/rust/elements/ImplicitVariableAccess.qll bc3cd90231216c41ddfcb7ac33974c3105b24b4fd712d1b7147cd0e1a7d84ac0 d8c6114b596cd27421fc7a11ec96439e2ad12396e0e4b3ec3dfa121a9b595c03 lib/codeql/rust/elements/IndexExpr.qll 0e2e9f018d06ae72be0fc4ddbc019a9aacd8a06f42b4c4431760bd149e7f2290 2bcfd557abd53a48e48de7915c4f2089107c62dfb3e732a904848248dfd3727b lib/codeql/rust/elements/InferType.qll c71184ae6aa181be94e299882503350e057493e17f1133a1e96162a0e5cbd1ef f0f19b611708df45a6ff811f8066c8042a8e1ac9b7bd94910514547ea430d3d5 lib/codeql/rust/elements/Item.qll 5c9148ff0eaeb4404c2d8156e7df0ef5753fd44ead972da05a49659ddaa25480 78446f788617e40525d4d4b489848e75f2143a90e18d40974c3bff7b1e7c825c @@ -500,6 +500,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/Function.qll f285ee0c771f897eba6db34a7e98f3cfb7db91b0df252ff4b37fc9d779de0bfb 07401e832565ff376acda219514c2e2bbe4ae5058c76a73b40ca6ca66f1626c7 lib/codeql/rust/elements/internal/generated/GenericArg.qll 464da0ba1c5ddcd1be68617167f177773d99b5ac4775ec8ea24d503e789a9099 6faa1033d59baf7c210ac4837a55781cfc054b7acbad8027faf4630dbfa6e101 lib/codeql/rust/elements/internal/generated/GenericArgList.qll b8cd936bba6f28344e28c98acf38acb8ef43af6ecf8367d79ed487e5b9da17cb 8b14331261e49d004807285b02fca190aafd62bfb9378b05c7d9c1e95525fe7b @@ -509,7 +510,6 @@ lib/codeql/rust/elements/internal/generated/IdentPat.qll a1269182132b2f52c5d842e lib/codeql/rust/elements/internal/generated/IfExpr.qll 413dd7a20c6b98c0d2ad2e5b50981c14bf96c1a719ace3e341d78926219a5af7 c9a2d44e3baa6a265a29a683ca3c1683352457987c92f599c5771b4f3b4bafff lib/codeql/rust/elements/internal/generated/Impl.qll e33ef5d3e49e64beca0ca9d5c0ba972d99007e5011eeedc11e67d3fbb569ab4a 5c5d88110864f4fd3d966b1ad973eaabd7a9c5a07adc18bff01dc09395214825 lib/codeql/rust/elements/internal/generated/ImplTraitType.qll 3c29684f5ef386b883b79dc9758441d97f090e065be177ffc8240aaf0f3d1e7b 03ea42c2a95cf917ec73d88b7b4ca5e53e10d7b046074f59100c0ec6c2c1ed6d -lib/codeql/rust/elements/internal/generated/ImplicitVariableAccess.qll 2fec3cc89735a89e0301edb89c392c75216906b0936331a957b26e281b9833ae f5eb6de1cb9d82e0fc5de8393a42823134ed19b6c0b1a091a7efe8eb06f29b85 lib/codeql/rust/elements/internal/generated/IndexExpr.qll cf951fc40f6690e966b4dc78fa9a6221aa5c6cade44759dcb52254f799292d11 1572e71918cc4e0b7e028331b6d98c9db23100a3646cd3874d1915e06ab6211d lib/codeql/rust/elements/internal/generated/InferType.qll 23ee25135c59ea5578cdf7c34a41f606e217e7260c3c8f404d12836585d5cad4 400da322fa1be62c4e300ebdf481eb92d4226eb6c316c668da8cc5168065774f lib/codeql/rust/elements/internal/generated/Item.qll 70930ebfea4d0b56c0c47bede0c7aa21ec119210467fecc58a850273efb9080d c3bce1b435c3370083a3ef95da7647e720ca4e636b83dfa0ccecbf11f7ecd34b @@ -551,7 +551,7 @@ 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 b23c62ed9b5402b8c8ac81270c3d7710deb8a0fbc3dfd3f406a980f2d4886f1e 3c2e9618592c8da2be069d1b4fc32062866072d0c5f594bf2983edbd0c3223ce +lib/codeql/rust/elements/internal/generated/ParentChild.qll 2c45ff4f645ec91ffe3bf2d726b478cb8bf959f26c14f0d56cacf21c0e4b153b 981485f9899afdf531eff63ae42fc202d257e00b04465c8792457d23b584faeb 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 @@ -560,7 +560,7 @@ lib/codeql/rust/elements/internal/generated/PathSegment.qll 4621597fd86246f788b8 lib/codeql/rust/elements/internal/generated/PathType.qll 45de78e5374d6eb0446e2112ec72d3692c2811df9fa2ad03d0127e426940abe3 622cf70408413a565a0dac58f451035ac1339c8d0ee5b24f630680201cb0aa48 lib/codeql/rust/elements/internal/generated/PrefixExpr.qll c9ede5f2deb7b41bc8240969e8554f645057018fe96e7e9ad9c2924c8b14722b 5ae2e3c3dc8fa73e7026ef6534185afa6b0b5051804435d8b741dd3640c864e1 lib/codeql/rust/elements/internal/generated/PtrType.qll 40099c5a4041314b66932dfd777c9e2bef90a0711fb8d7c2c2cec764c003ac4a cf8297d93557356a572223d3e8acca701837c4b1f54e8d4351ba195fb7ed27f8 -lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll b8e03f4c85c5ec208c0ba57ab1be3b2fc80e0d122198571b5f95dffe247af79b b8e03f4c85c5ec208c0ba57ab1be3b2fc80e0d122198571b5f95dffe247af79b +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 @@ -588,8 +588,8 @@ 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 9707fb1875b20c0b98ada41e7007c5d66b122e8770e232fc75c3b50c74363a4d cce150b2f7fd99e6b771f52683fd93f3d8e10393d1b747a8b6a78620a487c64b -lib/codeql/rust/elements/internal/generated/SynthConstructors.qll 44355a9dd08cbb357907f1ff94333fc0ec946c315c3be34e34d82abbc47c9a68 44355a9dd08cbb357907f1ff94333fc0ec946c315c3be34e34d82abbc47c9a68 +lib/codeql/rust/elements/internal/generated/Synth.qll 65bf61ce73c7d1cce98a470b292122a7a3b136804179386f4e7517e4d8f7b81e 4905af04e60fbb4ab54fee58880150a6eb71ad70fe1a5e30d9ec493b5689078d +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 lib/codeql/rust/elements/internal/generated/Trait.qll a570fa93d0b78a35766b00d5ca256c102f824564248b9d8b678a981d6eea3e2e d9c7475e5102e21cfdee3b1791f89a4f9cdba5a4200349ff706532b704c02664 @@ -623,7 +623,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 478d84148363d1141a9c0bddd25b82ee1219c3f8a7872aaaa3388b83ee3a3ffd 478d84148363d1141a9c0bddd25b82ee1219c3f8a7872aaaa3388b83ee3a3ffd +lib/codeql/rust/elements.qll ea1f5024fc6bde4845a0e390f7c59a2366deb2dc287e6f05cee96167fbe91754 ea1f5024fc6bde4845a0e390f7c59a2366deb2dc287e6f05cee96167fbe91754 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 diff --git a/rust/ql/.gitattributes b/rust/ql/.gitattributes index 13abe120cc73..413a838c3fb1 100644 --- a/rust/ql/.gitattributes +++ b/rust/ql/.gitattributes @@ -46,6 +46,7 @@ /lib/codeql/rust/elements/FormatArgsArg.qll linguist-generated /lib/codeql/rust/elements/FormatArgsExpr.qll linguist-generated /lib/codeql/rust/elements/FormatArgument.qll linguist-generated +/lib/codeql/rust/elements/FormatTemplateVariableAccess.qll linguist-generated /lib/codeql/rust/elements/Function.qll linguist-generated /lib/codeql/rust/elements/GenericArg.qll linguist-generated /lib/codeql/rust/elements/GenericArgList.qll linguist-generated @@ -55,7 +56,6 @@ /lib/codeql/rust/elements/IfExpr.qll linguist-generated /lib/codeql/rust/elements/Impl.qll linguist-generated /lib/codeql/rust/elements/ImplTraitType.qll linguist-generated -/lib/codeql/rust/elements/ImplicitVariableAccess.qll linguist-generated /lib/codeql/rust/elements/IndexExpr.qll linguist-generated /lib/codeql/rust/elements/InferType.qll linguist-generated /lib/codeql/rust/elements/Item.qll linguist-generated @@ -502,6 +502,7 @@ /lib/codeql/rust/elements/internal/generated/FormatArgsArg.qll linguist-generated /lib/codeql/rust/elements/internal/generated/FormatArgsExpr.qll linguist-generated /lib/codeql/rust/elements/internal/generated/FormatArgument.qll linguist-generated +/lib/codeql/rust/elements/internal/generated/FormatTemplateVariableAccess.qll linguist-generated /lib/codeql/rust/elements/internal/generated/Function.qll linguist-generated /lib/codeql/rust/elements/internal/generated/GenericArg.qll linguist-generated /lib/codeql/rust/elements/internal/generated/GenericArgList.qll linguist-generated @@ -511,7 +512,6 @@ /lib/codeql/rust/elements/internal/generated/IfExpr.qll linguist-generated /lib/codeql/rust/elements/internal/generated/Impl.qll linguist-generated /lib/codeql/rust/elements/internal/generated/ImplTraitType.qll linguist-generated -/lib/codeql/rust/elements/internal/generated/ImplicitVariableAccess.qll linguist-generated /lib/codeql/rust/elements/internal/generated/IndexExpr.qll linguist-generated /lib/codeql/rust/elements/internal/generated/InferType.qll linguist-generated /lib/codeql/rust/elements/internal/generated/Item.qll linguist-generated diff --git a/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll b/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll index f72f47798430..d2f4e3325155 100644 --- a/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll +++ b/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll @@ -94,7 +94,7 @@ class FormatArgsExprTree extends StandardPostOrderTree, FormatArgsExpr { result = this.getArg(i).getExpr() or result = - any(ImplicitVariableAccess v, Format f, int index, int kind | + any(FormatTemplateVariableAccess v, Format f, int index, int kind | f = this.getFormat(index) and ( v.getArgument() = f.getArgumentRef() and kind = 0 @@ -110,7 +110,7 @@ class FormatArgsExprTree extends StandardPostOrderTree, FormatArgsExpr { } } -class ImplictVariableAccessTree extends LeafTree, ImplicitVariableAccess { } +class FormatTemplateVariableAccessTree extends LeafTree, FormatTemplateVariableAccess { } class ItemTree extends LeafTree, Item { ItemTree() { diff --git a/rust/ql/lib/codeql/rust/elements.qll b/rust/ql/lib/codeql/rust/elements.qll index 6451298d8bca..010d83c9b0f6 100644 --- a/rust/ql/lib/codeql/rust/elements.qll +++ b/rust/ql/lib/codeql/rust/elements.qll @@ -49,6 +49,7 @@ import codeql.rust.elements.Format import codeql.rust.elements.FormatArgsArg import codeql.rust.elements.FormatArgsExpr import codeql.rust.elements.FormatArgument +import codeql.rust.elements.FormatTemplateVariableAccess import codeql.rust.elements.Function import codeql.rust.elements.GenericArg import codeql.rust.elements.GenericArgList @@ -58,7 +59,6 @@ import codeql.rust.elements.IdentPat import codeql.rust.elements.IfExpr import codeql.rust.elements.Impl import codeql.rust.elements.ImplTraitType -import codeql.rust.elements.ImplicitVariableAccess import codeql.rust.elements.IndexExpr import codeql.rust.elements.InferType import codeql.rust.elements.Item diff --git a/rust/ql/lib/codeql/rust/elements/FormatTemplateVariableAccess.qll b/rust/ql/lib/codeql/rust/elements/FormatTemplateVariableAccess.qll new file mode 100644 index 000000000000..6ab1950373a4 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/FormatTemplateVariableAccess.qll @@ -0,0 +1,9 @@ +// generated by codegen, do not edit +/** + * This module provides the public class `FormatTemplateVariableAccess`. + */ + +private import internal.FormatTemplateVariableAccessImpl +import codeql.rust.elements.Expr + +final class FormatTemplateVariableAccess = Impl::FormatTemplateVariableAccess; diff --git a/rust/ql/lib/codeql/rust/elements/ImplicitVariableAccess.qll b/rust/ql/lib/codeql/rust/elements/ImplicitVariableAccess.qll deleted file mode 100644 index aca8f1953a17..000000000000 --- a/rust/ql/lib/codeql/rust/elements/ImplicitVariableAccess.qll +++ /dev/null @@ -1,9 +0,0 @@ -// generated by codegen, do not edit -/** - * This module provides the public class `ImplicitVariableAccess`. - */ - -private import internal.ImplicitVariableAccessImpl -import codeql.rust.elements.Expr - -final class ImplicitVariableAccess = Impl::ImplicitVariableAccess; diff --git a/rust/ql/lib/codeql/rust/elements/internal/ImplicitVariableAccessConstructor.qll b/rust/ql/lib/codeql/rust/elements/internal/FormatTemplateVariableAccessConstructor.qll similarity index 81% rename from rust/ql/lib/codeql/rust/elements/internal/ImplicitVariableAccessConstructor.qll rename to rust/ql/lib/codeql/rust/elements/internal/FormatTemplateVariableAccessConstructor.qll index 0ecf191795c9..7682d14ce46c 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/ImplicitVariableAccessConstructor.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/FormatTemplateVariableAccessConstructor.qll @@ -1,6 +1,6 @@ /** * This module defines the hook used internally to tweak the characteristic predicate of - * `ImplicitVariableAccess` synthesized instances. + * `FormatTemplateVariableAccess` synthesized instances. * INTERNAL: Do not use. */ @@ -10,10 +10,10 @@ private import codeql.rust.elements.Format private import codeql.rust.elements.NamedFormatArgument /** - * The characteristic predicate of `ImplicitVariableAccess` synthesized instances. + * The characteristic predicate of `FormatTemplateVariableAccess` synthesized instances. * INTERNAL: Do not use. */ -predicate constructImplicitVariableAccess(Raw::FormatArgsExpr parent, int index, int kind) { +predicate constructFormatTemplateVariableAccess(Raw::FormatArgsExpr parent, int index, int kind) { unboundNamedFormatArgument(parent, index, kind, _) } diff --git a/rust/ql/lib/codeql/rust/elements/internal/ImplicitVariableAccessImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/FormatTemplateVariableAccessImpl.qll similarity index 70% rename from rust/ql/lib/codeql/rust/elements/internal/ImplicitVariableAccessImpl.qll rename to rust/ql/lib/codeql/rust/elements/internal/FormatTemplateVariableAccessImpl.qll index 4ab1ee5a5da6..a9379f80e40e 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/ImplicitVariableAccessImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/FormatTemplateVariableAccessImpl.qll @@ -1,27 +1,27 @@ /** - * This module provides a hand-modifiable wrapper around the generated class `ImplicitVariableAccess`. + * This module provides a hand-modifiable wrapper around the generated class `FormatTemplateVariableAccess`. * * INTERNAL: Do not use. */ -private import codeql.rust.elements.internal.generated.ImplicitVariableAccess -private import codeql.rust.elements.internal.ImplicitVariableAccessConstructor +private import codeql.rust.elements.internal.generated.FormatTemplateVariableAccess +private import codeql.rust.elements.internal.FormatTemplateVariableAccessConstructor private import codeql.rust.elements.internal.generated.Raw private import codeql.rust.elements.internal.generated.Synth private import codeql.rust.elements.Format private import codeql.rust.elements.NamedFormatArgument /** - * INTERNAL: This module contains the customizable definition of `ImplicitVariableAccess` and should not + * INTERNAL: This module contains the customizable definition of `FormatTemplateVariableAccess` and should not * be referenced directly. */ module Impl { - class ImplicitVariableAccess extends Generated::ImplicitVariableAccess { + class FormatTemplateVariableAccess extends Generated::FormatTemplateVariableAccess { private NamedFormatArgument argument; - ImplicitVariableAccess() { + FormatTemplateVariableAccess() { exists(Raw::FormatArgsExpr parent, int index, int kind | - this = Synth::TImplicitVariableAccess(parent, index, kind) and + this = Synth::TFormatTemplateVariableAccess(parent, index, kind) and unboundNamedFormatArgument(parent, index, kind, argument) ) } diff --git a/rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll index 9300c2c6109c..7d7e80897fc3 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll @@ -2,7 +2,7 @@ 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.ImplicitVariableAccessImpl::Impl as ImplicitVariableAccessImpl +private import codeql.rust.elements.internal.FormatTemplateVariableAccessImpl::Impl as FormatTemplateVariableAccessImpl private import codeql.util.DenseRank module Impl { @@ -155,7 +155,7 @@ module Impl { name_ = ps.getNameRef().getText() ) or - this.(ImplicitVariableAccess).getName() = name_ + this.(FormatTemplateVariableAccess).getName() = name_ } string toString() { result = name_ } @@ -168,7 +168,7 @@ module Impl { this.(PathExpr) .getLocation() .hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) or - this.(ImplicitVariableAccess) + this.(FormatTemplateVariableAccess) .hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) } } @@ -182,7 +182,7 @@ module Impl { ) and exists(AstNode n0 | result = getImmediateParent(n0) or - result = n0.(ImplicitVariableAccess).getArgument().getParent().getParent() + result = n0.(FormatTemplateVariableAccess).getArgument().getParent().getParent() | n0 = n or @@ -449,7 +449,7 @@ module Impl { private import codeql.rust.controlflow.internal.Scope private import codeql.rust.elements.internal.generated.Synth - private class TVariableAccess = Synth::TPathExpr or Synth::TImplicitVariableAccess; + private class TVariableAccess = Synth::TPathExpr or Synth::TFormatTemplateVariableAccess; /** A variable access. */ abstract class VariableAccess extends ExprImpl::Expr, TVariableAccess instanceof VariableAccessCand @@ -474,8 +474,8 @@ module Impl { override string getAPrimaryQlClass() { result = VariableAccess.super.getAPrimaryQlClass() } } - private class VariableAccessImplicitVariableAccess extends VariableAccess, - ImplicitVariableAccessImpl::ImplicitVariableAccess + private class VariableAccessFormatTemplateVariableAccess extends VariableAccess, + FormatTemplateVariableAccessImpl::FormatTemplateVariableAccess { override string toString() { result = VariableAccess.super.toString() } diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/FormatTemplateVariableAccess.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/FormatTemplateVariableAccess.qll new file mode 100644 index 000000000000..b5efdc7635ed --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/FormatTemplateVariableAccess.qll @@ -0,0 +1,23 @@ +// generated by codegen, do not edit +/** + * This module provides the generated definition of `FormatTemplateVariableAccess`. + * 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 `FormatTemplateVariableAccess` and should not + * be referenced directly. + */ +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 { + override string getAPrimaryQlClass() { result = "FormatTemplateVariableAccess" } + } +} diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/ImplicitVariableAccess.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/ImplicitVariableAccess.qll deleted file mode 100644 index f97241cbae24..000000000000 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/ImplicitVariableAccess.qll +++ /dev/null @@ -1,23 +0,0 @@ -// generated by codegen, do not edit -/** - * This module provides the generated definition of `ImplicitVariableAccess`. - * 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 `ImplicitVariableAccess` and should not - * be referenced directly. - */ -module Generated { - /** - * INTERNAL: Do not reference the `Generated::ImplicitVariableAccess` class directly. - * Use the subclass `ImplicitVariableAccess`, where the following predicates are available. - */ - class ImplicitVariableAccess extends Synth::TImplicitVariableAccess, ExprImpl::Expr { - override string getAPrimaryQlClass() { result = "ImplicitVariableAccess" } - } -} diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll index ff8d2b460521..903bffd9b53a 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll @@ -1790,6 +1790,21 @@ 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 @@ -1857,21 +1872,6 @@ private module Impl { ) } - private Element getImmediateChildOfImplicitVariableAccess( - ImplicitVariableAccess 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 getImmediateChildOfIndexExpr(IndexExpr e, int index, string partialPredicateCall) { exists(int b, int bExpr, int n, int nAttr, int nBase, int nIndex | b = 0 and @@ -3652,14 +3652,14 @@ 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) or result = getImmediateChildOfImplTraitType(e, index, partialAccessor) or - result = getImmediateChildOfImplicitVariableAccess(e, index, partialAccessor) - or result = getImmediateChildOfIndexExpr(e, index, partialAccessor) or result = getImmediateChildOfInferType(e, index, partialAccessor) diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll index 72e1a2aa6ec5..382ab59ed8ce 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll @@ -5,4 +5,4 @@ import codeql.rust.elements.internal.FormatConstructor import codeql.rust.elements.internal.FormatArgumentConstructor -import codeql.rust.elements.internal.ImplicitVariableAccessConstructor +import codeql.rust.elements.internal.FormatTemplateVariableAccessConstructor diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/Synth.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/Synth.qll index b693e6814797..725d00089b74 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/Synth.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/Synth.qll @@ -168,6 +168,12 @@ module Synth { TFormatArgument(Raw::FormatArgsExpr parent, int index, int kind) { constructFormatArgument(parent, index, kind) } or + /** + * INTERNAL: Do not use. + */ + TFormatTemplateVariableAccess(Raw::FormatArgsExpr parent, int index, int kind) { + constructFormatTemplateVariableAccess(parent, index, kind) + } or /** * INTERNAL: Do not use. */ @@ -196,12 +202,6 @@ module Synth { * INTERNAL: Do not use. */ TImplTraitType(Raw::ImplTraitType id) { constructImplTraitType(id) } or - /** - * INTERNAL: Do not use. - */ - TImplicitVariableAccess(Raw::FormatArgsExpr parent, int index, int kind) { - constructImplicitVariableAccess(parent, index, kind) - } or /** * INTERNAL: Do not use. */ @@ -643,7 +643,7 @@ 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 TIfExpr or TImplicitVariableAccess or TIndexExpr 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 @@ -941,6 +941,14 @@ module Synth { */ TFormatArgument convertFormatArgumentFromRaw(Raw::Element e) { none() } + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TFormatTemplateVariableAccess`, if possible. + */ + TFormatTemplateVariableAccess convertFormatTemplateVariableAccessFromRaw(Raw::Element e) { + none() + } + /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TFunction`, if possible. @@ -983,12 +991,6 @@ module Synth { */ TImplTraitType convertImplTraitTypeFromRaw(Raw::Element e) { result = TImplTraitType(e) } - /** - * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TImplicitVariableAccess`, if possible. - */ - TImplicitVariableAccess convertImplicitVariableAccessFromRaw(Raw::Element e) { none() } - /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TIndexExpr`, if possible. @@ -1798,9 +1800,9 @@ module Synth { or result = convertFormatArgsExprFromRaw(e) or - result = convertIfExprFromRaw(e) + result = convertFormatTemplateVariableAccessFromRaw(e) or - result = convertImplicitVariableAccessFromRaw(e) + result = convertIfExprFromRaw(e) or result = convertIndexExprFromRaw(e) or @@ -2273,6 +2275,12 @@ module Synth { */ Raw::Element convertFormatArgumentToRaw(TFormatArgument e) { none() } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TFormatTemplateVariableAccess` to a raw DB element, if possible. + */ + Raw::Element convertFormatTemplateVariableAccessToRaw(TFormatTemplateVariableAccess e) { none() } + /** * INTERNAL: Do not use. * Converts a synthesized `TFunction` to a raw DB element, if possible. @@ -2315,12 +2323,6 @@ module Synth { */ Raw::Element convertImplTraitTypeToRaw(TImplTraitType e) { e = TImplTraitType(result) } - /** - * INTERNAL: Do not use. - * Converts a synthesized `TImplicitVariableAccess` to a raw DB element, if possible. - */ - Raw::Element convertImplicitVariableAccessToRaw(TImplicitVariableAccess e) { none() } - /** * INTERNAL: Do not use. * Converts a synthesized `TIndexExpr` to a raw DB element, if possible. @@ -3130,9 +3132,9 @@ module Synth { or result = convertFormatArgsExprToRaw(e) or - result = convertIfExprToRaw(e) + result = convertFormatTemplateVariableAccessToRaw(e) or - result = convertImplicitVariableAccessToRaw(e) + result = convertIfExprToRaw(e) or result = convertIndexExprToRaw(e) or diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/SynthConstructors.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/SynthConstructors.qll index 371bc8b720aa..9b68c858c6a5 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/SynthConstructors.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/SynthConstructors.qll @@ -41,6 +41,7 @@ import codeql.rust.elements.internal.FormatConstructor import codeql.rust.elements.internal.FormatArgsArgConstructor import codeql.rust.elements.internal.FormatArgsExprConstructor import codeql.rust.elements.internal.FormatArgumentConstructor +import codeql.rust.elements.internal.FormatTemplateVariableAccessConstructor import codeql.rust.elements.internal.FunctionConstructor import codeql.rust.elements.internal.GenericArgListConstructor import codeql.rust.elements.internal.GenericParamListConstructor @@ -48,7 +49,6 @@ import codeql.rust.elements.internal.IdentPatConstructor import codeql.rust.elements.internal.IfExprConstructor import codeql.rust.elements.internal.ImplConstructor import codeql.rust.elements.internal.ImplTraitTypeConstructor -import codeql.rust.elements.internal.ImplicitVariableAccessConstructor import codeql.rust.elements.internal.IndexExprConstructor import codeql.rust.elements.internal.InferTypeConstructor import codeql.rust.elements.internal.ItemListConstructor diff --git a/rust/schema/annotations.py b/rust/schema/annotations.py index 67de68610e58..54bf7e2ff483 100644 --- a/rust/schema/annotations.py +++ b/rust/schema/annotations.py @@ -1758,7 +1758,7 @@ class _: @qltest.skip @synth.on_arguments(parent="FormatArgsExpr", index=int, kind=int) -class ImplicitVariableAccess(Expr): +class FormatTemplateVariableAccess(Expr): pass