From 00ecdb0a83b6cf44106ee42a1e87e4d640fb9b35 Mon Sep 17 00:00:00 2001 From: Ed Minnix Date: Wed, 18 Dec 2024 20:52:00 -0500 Subject: [PATCH 1/3] Fix typo in NavigationManager name in model --- csharp/ql/lib/ext/Microsoft.AspNetCore.Components.model.yml | 6 +++--- .../library-tests/dataflow/library/FlowSummaries.expected | 4 ++++ .../dataflow/library/FlowSummariesFiltered.expected | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/csharp/ql/lib/ext/Microsoft.AspNetCore.Components.model.yml b/csharp/ql/lib/ext/Microsoft.AspNetCore.Components.model.yml index 8617d8e90f0d..e0609a8fcb8c 100644 --- a/csharp/ql/lib/ext/Microsoft.AspNetCore.Components.model.yml +++ b/csharp/ql/lib/ext/Microsoft.AspNetCore.Components.model.yml @@ -3,13 +3,13 @@ extensions: pack: codeql/csharp-all extensible: sourceModel data: - - ["Microsoft.AspNetCore.Components", "NagivationManager", True, "get_BaseUri", "", "", "ReturnValue", "remote", "manual"] - - ["Microsoft.AspNetCore.Components", "NagivationManager", True, "get_Uri", "", "", "ReturnValue", "remote", "manual"] + - ["Microsoft.AspNetCore.Components", "NavigationManager", True, "get_BaseUri", "", "", "ReturnValue", "remote", "manual"] + - ["Microsoft.AspNetCore.Components", "NavigationManager", True, "get_Uri", "", "", "ReturnValue", "remote", "manual"] - addsTo: pack: codeql/csharp-all extensible: summaryModel data: - - ["Microsoft.AspNetCore.Components", "NagivationManager", True, "ToAbsoluteUri", "(System.String)", "", "Argument[0]", "ReturnValue", "taint", "manual"] + - ["Microsoft.AspNetCore.Components", "NavigationManager", True, "ToAbsoluteUri", "(System.String)", "", "Argument[0]", "ReturnValue", "taint", "manual"] - addsTo: pack: codeql/csharp-all extensible: sinkModel diff --git a/csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected b/csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected index e08060fe3436..89d102fc4c0a 100644 --- a/csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected +++ b/csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected @@ -90,6 +90,8 @@ source | Dapper;SqlMapper;QuerySingleOrDefaultAsync;(System.Data.IDbConnection,System.Type,System.String,System.Object,System.Data.IDbTransaction,System.Nullable,System.Nullable);ReturnValue;database;manual | | Dapper;SqlMapper;QuerySingleOrDefaultAsync;(System.Data.IDbConnection,Dapper.CommandDefinition);ReturnValue;database;manual | | Dapper;SqlMapper;QuerySingleOrDefaultAsync;(System.Data.IDbConnection,System.String,System.Object,System.Data.IDbTransaction,System.Nullable,System.Nullable);ReturnValue;database;manual | +| Microsoft.AspNetCore.Components;NavigationManager;get_BaseUri;();ReturnValue;remote;manual | +| Microsoft.AspNetCore.Components;NavigationManager;get_Uri;();ReturnValue;remote;manual | | Microsoft.Extensions.Configuration.UserSecrets;PathHelper;GetSecretsPathFromSecretsId;(System.String);ReturnValue;environment;df-generated | | Microsoft.Extensions.Configuration;EnvironmentVariablesExtensions;AddEnvironmentVariables;(Microsoft.Extensions.Configuration.IConfigurationBuilder);Argument[0];environment;manual | | Microsoft.Extensions.Configuration;EnvironmentVariablesExtensions;AddEnvironmentVariables;(Microsoft.Extensions.Configuration.IConfigurationBuilder);ReturnValue;environment;manual | @@ -984,6 +986,7 @@ summary | Microsoft.AspNetCore.Components.RenderTree;Renderer;add_UnhandledSynchronizationException;(System.UnhandledExceptionEventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.RenderTree;Renderer;remove_UnhandledSynchronizationException;(System.UnhandledExceptionEventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;ComponentState;DisposeAsync;();Argument[this];ReturnValue;taint;df-generated | +| Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddComponentParameter;(System.Int32,System.String,System.Object);Argument[2];Argument[1];taint;manual | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddComponentReferenceCapture;(System.Int32,System.Action);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddContent;(System.Int32,Microsoft.AspNetCore.Components.RenderFragment);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddContent;(System.Int32,Microsoft.AspNetCore.Components.RenderFragment,TValue);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | @@ -1117,6 +1120,7 @@ summary | Microsoft.AspNetCore.Components;LayoutComponentBase;set_Body;(Microsoft.AspNetCore.Components.RenderFragment);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components;LayoutView;set_ChildContent;(Microsoft.AspNetCore.Components.RenderFragment);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components;NavigationManager;RegisterLocationChangingHandler;(System.Func);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | +| Microsoft.AspNetCore.Components;NavigationManager;ToAbsoluteUri;(System.String);Argument[0];ReturnValue;taint;manual | | Microsoft.AspNetCore.Components;NavigationManager;add_LocationChanged;(System.EventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components;NavigationManager;remove_LocationChanged;(System.EventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components;PersistentComponentState;RegisterOnPersisting;(System.Func);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | diff --git a/csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected b/csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected index 79bc3c9fa8b4..1c597b3cc5a4 100644 --- a/csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected +++ b/csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected @@ -191,6 +191,7 @@ | Microsoft.AspNetCore.Components.Forms;ValidationMessageStore;get_Item;(System.Linq.Expressions.Expression>);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.RenderTree;Renderer;add_UnhandledSynchronizationException;(System.UnhandledExceptionEventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.RenderTree;Renderer;remove_UnhandledSynchronizationException;(System.UnhandledExceptionEventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | +| Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddComponentParameter;(System.Int32,System.String,System.Object);Argument[2];Argument[1];taint;manual | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddComponentReferenceCapture;(System.Int32,System.Action);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddContent;(System.Int32,Microsoft.AspNetCore.Components.RenderFragment);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddContent;(System.Int32,Microsoft.AspNetCore.Components.RenderFragment,TValue);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | @@ -321,6 +322,7 @@ | Microsoft.AspNetCore.Components;LayoutComponentBase;set_Body;(Microsoft.AspNetCore.Components.RenderFragment);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components;LayoutView;set_ChildContent;(Microsoft.AspNetCore.Components.RenderFragment);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components;NavigationManager;RegisterLocationChangingHandler;(System.Func);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | +| Microsoft.AspNetCore.Components;NavigationManager;ToAbsoluteUri;(System.String);Argument[0];ReturnValue;taint;manual | | Microsoft.AspNetCore.Components;NavigationManager;add_LocationChanged;(System.EventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components;NavigationManager;remove_LocationChanged;(System.EventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components;PersistentComponentState;RegisterOnPersisting;(System.Func);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | From b1bba731b408202854057fa970bee19044d6f504 Mon Sep 17 00:00:00 2001 From: Ed Minnix Date: Wed, 18 Dec 2024 21:05:52 -0500 Subject: [PATCH 2/3] Remove irrelevant test results --- .../test/library-tests/dataflow/library/FlowSummaries.expected | 1 - .../dataflow/library/FlowSummariesFiltered.expected | 1 - 2 files changed, 2 deletions(-) diff --git a/csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected b/csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected index 89d102fc4c0a..6c5524bfd2d9 100644 --- a/csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected +++ b/csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected @@ -986,7 +986,6 @@ summary | Microsoft.AspNetCore.Components.RenderTree;Renderer;add_UnhandledSynchronizationException;(System.UnhandledExceptionEventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.RenderTree;Renderer;remove_UnhandledSynchronizationException;(System.UnhandledExceptionEventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;ComponentState;DisposeAsync;();Argument[this];ReturnValue;taint;df-generated | -| Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddComponentParameter;(System.Int32,System.String,System.Object);Argument[2];Argument[1];taint;manual | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddComponentReferenceCapture;(System.Int32,System.Action);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddContent;(System.Int32,Microsoft.AspNetCore.Components.RenderFragment);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddContent;(System.Int32,Microsoft.AspNetCore.Components.RenderFragment,TValue);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | diff --git a/csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected b/csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected index 1c597b3cc5a4..f6fe3b940435 100644 --- a/csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected +++ b/csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected @@ -191,7 +191,6 @@ | Microsoft.AspNetCore.Components.Forms;ValidationMessageStore;get_Item;(System.Linq.Expressions.Expression>);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.RenderTree;Renderer;add_UnhandledSynchronizationException;(System.UnhandledExceptionEventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.RenderTree;Renderer;remove_UnhandledSynchronizationException;(System.UnhandledExceptionEventHandler);Argument[0];Argument[0].Parameter[delegate-self];value;hq-generated | -| Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddComponentParameter;(System.Int32,System.String,System.Object);Argument[2];Argument[1];taint;manual | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddComponentReferenceCapture;(System.Int32,System.Action);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddContent;(System.Int32,Microsoft.AspNetCore.Components.RenderFragment);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | | Microsoft.AspNetCore.Components.Rendering;RenderTreeBuilder;AddContent;(System.Int32,Microsoft.AspNetCore.Components.RenderFragment,TValue);Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated | From a28ddd642cf3989e157d25109335fefe723a50ad Mon Sep 17 00:00:00 2001 From: Simon Friis Vindum Date: Thu, 19 Dec 2024 13:12:45 +0100 Subject: [PATCH 3/3] Rust: Add variables example with let statement in macro --- .../test/library-tests/variables/Cfg.expected | 236 ++++++++++-------- .../test/library-tests/variables/Ssa.expected | 5 + .../variables/variables.expected | 6 + .../test/library-tests/variables/variables.rs | 16 ++ 4 files changed, 154 insertions(+), 109 deletions(-) diff --git a/rust/ql/test/library-tests/variables/Cfg.expected b/rust/ql/test/library-tests/variables/Cfg.expected index 0763f7a4e4b8..cb8c5b3eb2c2 100644 --- a/rust/ql/test/library-tests/variables/Cfg.expected +++ b/rust/ql/test/library-tests/variables/Cfg.expected @@ -1231,114 +1231,132 @@ edges | variables.rs:541:3:541:19 | ExprStmt | variables.rs:541:3:541:11 | print_i64 | | | variables.rs:541:13:541:13 | a | variables.rs:541:13:541:17 | a.val | | | variables.rs:541:13:541:17 | a.val | variables.rs:541:3:541:18 | print_i64(...) | | -| variables.rs:544:1:578:1 | enter fn main | variables.rs:545:5:545:25 | ExprStmt | | -| variables.rs:544:1:578:1 | exit fn main (normal) | variables.rs:544:1:578:1 | exit fn main | | -| variables.rs:544:11:578:1 | { ... } | variables.rs:544:1:578:1 | exit fn main (normal) | | -| variables.rs:545:5:545:22 | immutable_variable | variables.rs:545:5:545:24 | immutable_variable(...) | | -| variables.rs:545:5:545:24 | immutable_variable(...) | variables.rs:546:5:546:23 | ExprStmt | | -| variables.rs:545:5:545:25 | ExprStmt | variables.rs:545:5:545:22 | immutable_variable | | -| variables.rs:546:5:546:20 | mutable_variable | variables.rs:546:5:546:22 | mutable_variable(...) | | -| variables.rs:546:5:546:22 | mutable_variable(...) | variables.rs:547:5:547:40 | ExprStmt | | -| variables.rs:546:5:546:23 | ExprStmt | variables.rs:546:5:546:20 | mutable_variable | | -| variables.rs:547:5:547:37 | mutable_variable_immutable_borrow | variables.rs:547:5:547:39 | mutable_variable_immutable_borrow(...) | | -| variables.rs:547:5:547:39 | mutable_variable_immutable_borrow(...) | variables.rs:548:5:548:23 | ExprStmt | | -| variables.rs:547:5:547:40 | ExprStmt | variables.rs:547:5:547:37 | mutable_variable_immutable_borrow | | -| variables.rs:548:5:548:20 | variable_shadow1 | variables.rs:548:5:548:22 | variable_shadow1(...) | | -| variables.rs:548:5:548:22 | variable_shadow1(...) | variables.rs:549:5:549:23 | ExprStmt | | -| variables.rs:548:5:548:23 | ExprStmt | variables.rs:548:5:548:20 | variable_shadow1 | | -| variables.rs:549:5:549:20 | variable_shadow2 | variables.rs:549:5:549:22 | variable_shadow2(...) | | -| variables.rs:549:5:549:22 | variable_shadow2(...) | variables.rs:550:5:550:19 | ExprStmt | | -| variables.rs:549:5:549:23 | ExprStmt | variables.rs:549:5:549:20 | variable_shadow2 | | -| variables.rs:550:5:550:16 | let_pattern1 | variables.rs:550:5:550:18 | let_pattern1(...) | | -| variables.rs:550:5:550:18 | let_pattern1(...) | variables.rs:551:5:551:19 | ExprStmt | | -| variables.rs:550:5:550:19 | ExprStmt | variables.rs:550:5:550:16 | let_pattern1 | | -| variables.rs:551:5:551:16 | let_pattern2 | variables.rs:551:5:551:18 | let_pattern2(...) | | -| variables.rs:551:5:551:18 | let_pattern2(...) | variables.rs:552:5:552:19 | ExprStmt | | -| variables.rs:551:5:551:19 | ExprStmt | variables.rs:551:5:551:16 | let_pattern2 | | -| variables.rs:552:5:552:16 | let_pattern3 | variables.rs:552:5:552:18 | let_pattern3(...) | | -| variables.rs:552:5:552:18 | let_pattern3(...) | variables.rs:553:5:553:19 | ExprStmt | | -| variables.rs:552:5:552:19 | ExprStmt | variables.rs:552:5:552:16 | let_pattern3 | | -| variables.rs:553:5:553:16 | let_pattern4 | variables.rs:553:5:553:18 | let_pattern4(...) | | -| variables.rs:553:5:553:18 | let_pattern4(...) | variables.rs:554:5:554:21 | ExprStmt | | -| variables.rs:553:5:553:19 | ExprStmt | variables.rs:553:5:553:16 | let_pattern4 | | -| variables.rs:554:5:554:18 | match_pattern1 | variables.rs:554:5:554:20 | match_pattern1(...) | | -| variables.rs:554:5:554:20 | match_pattern1(...) | variables.rs:555:5:555:21 | ExprStmt | | -| variables.rs:554:5:554:21 | ExprStmt | variables.rs:554:5:554:18 | match_pattern1 | | -| variables.rs:555:5:555:18 | match_pattern2 | variables.rs:555:5:555:20 | match_pattern2(...) | | -| variables.rs:555:5:555:20 | match_pattern2(...) | variables.rs:556:5:556:21 | ExprStmt | | -| variables.rs:555:5:555:21 | ExprStmt | variables.rs:555:5:555:18 | match_pattern2 | | -| variables.rs:556:5:556:18 | match_pattern3 | variables.rs:556:5:556:20 | match_pattern3(...) | | -| variables.rs:556:5:556:20 | match_pattern3(...) | variables.rs:557:5:557:21 | ExprStmt | | -| variables.rs:556:5:556:21 | ExprStmt | variables.rs:556:5:556:18 | match_pattern3 | | -| variables.rs:557:5:557:18 | match_pattern4 | variables.rs:557:5:557:20 | match_pattern4(...) | | -| variables.rs:557:5:557:20 | match_pattern4(...) | variables.rs:558:5:558:21 | ExprStmt | | -| variables.rs:557:5:557:21 | ExprStmt | variables.rs:557:5:557:18 | match_pattern4 | | -| variables.rs:558:5:558:18 | match_pattern5 | variables.rs:558:5:558:20 | match_pattern5(...) | | -| variables.rs:558:5:558:20 | match_pattern5(...) | variables.rs:559:5:559:21 | ExprStmt | | -| variables.rs:558:5:558:21 | ExprStmt | variables.rs:558:5:558:18 | match_pattern5 | | -| variables.rs:559:5:559:18 | match_pattern6 | variables.rs:559:5:559:20 | match_pattern6(...) | | -| variables.rs:559:5:559:20 | match_pattern6(...) | variables.rs:560:5:560:21 | ExprStmt | | -| variables.rs:559:5:559:21 | ExprStmt | variables.rs:559:5:559:18 | match_pattern6 | | -| variables.rs:560:5:560:18 | match_pattern7 | variables.rs:560:5:560:20 | match_pattern7(...) | | -| variables.rs:560:5:560:20 | match_pattern7(...) | variables.rs:561:5:561:21 | ExprStmt | | -| variables.rs:560:5:560:21 | ExprStmt | variables.rs:560:5:560:18 | match_pattern7 | | -| variables.rs:561:5:561:18 | match_pattern8 | variables.rs:561:5:561:20 | match_pattern8(...) | | -| variables.rs:561:5:561:20 | match_pattern8(...) | variables.rs:562:5:562:21 | ExprStmt | | -| variables.rs:561:5:561:21 | ExprStmt | variables.rs:561:5:561:18 | match_pattern8 | | -| variables.rs:562:5:562:18 | match_pattern9 | variables.rs:562:5:562:20 | match_pattern9(...) | | -| variables.rs:562:5:562:20 | match_pattern9(...) | variables.rs:563:5:563:36 | ExprStmt | | -| variables.rs:562:5:562:21 | ExprStmt | variables.rs:562:5:562:18 | match_pattern9 | | -| variables.rs:563:5:563:18 | param_pattern1 | variables.rs:563:20:563:22 | "a" | | -| variables.rs:563:5:563:35 | param_pattern1(...) | variables.rs:564:5:564:37 | ExprStmt | | -| variables.rs:563:5:563:36 | ExprStmt | variables.rs:563:5:563:18 | param_pattern1 | | -| variables.rs:563:20:563:22 | "a" | variables.rs:563:26:563:28 | "b" | | -| variables.rs:563:25:563:34 | TupleExpr | variables.rs:563:5:563:35 | param_pattern1(...) | | -| variables.rs:563:26:563:28 | "b" | variables.rs:563:31:563:33 | "c" | | -| variables.rs:563:31:563:33 | "c" | variables.rs:563:25:563:34 | TupleExpr | | -| variables.rs:564:5:564:18 | param_pattern2 | variables.rs:564:20:564:31 | ...::Left | | -| variables.rs:564:5:564:36 | param_pattern2(...) | variables.rs:565:5:565:26 | ExprStmt | | -| variables.rs:564:5:564:37 | ExprStmt | variables.rs:564:5:564:18 | param_pattern2 | | -| variables.rs:564:20:564:31 | ...::Left | variables.rs:564:33:564:34 | 45 | | -| variables.rs:564:20:564:35 | ...::Left(...) | variables.rs:564:5:564:36 | param_pattern2(...) | | -| variables.rs:564:33:564:34 | 45 | variables.rs:564:20:564:35 | ...::Left(...) | | -| variables.rs:565:5:565:23 | destruct_assignment | variables.rs:565:5:565:25 | destruct_assignment(...) | | -| variables.rs:565:5:565:25 | destruct_assignment(...) | variables.rs:566:5:566:23 | ExprStmt | | -| variables.rs:565:5:565:26 | ExprStmt | variables.rs:565:5:565:23 | destruct_assignment | | -| variables.rs:566:5:566:20 | closure_variable | variables.rs:566:5:566:22 | closure_variable(...) | | -| variables.rs:566:5:566:22 | closure_variable(...) | variables.rs:567:5:567:19 | ExprStmt | | -| variables.rs:566:5:566:23 | ExprStmt | variables.rs:566:5:566:20 | closure_variable | | -| variables.rs:567:5:567:16 | for_variable | variables.rs:567:5:567:18 | for_variable(...) | | -| variables.rs:567:5:567:18 | for_variable(...) | variables.rs:568:5:568:17 | ExprStmt | | -| variables.rs:567:5:567:19 | ExprStmt | variables.rs:567:5:567:16 | for_variable | | -| variables.rs:568:5:568:14 | add_assign | variables.rs:568:5:568:16 | add_assign(...) | | -| variables.rs:568:5:568:16 | add_assign(...) | variables.rs:569:5:569:13 | ExprStmt | | -| variables.rs:568:5:568:17 | ExprStmt | variables.rs:568:5:568:14 | add_assign | | -| variables.rs:569:5:569:10 | mutate | variables.rs:569:5:569:12 | mutate(...) | | -| variables.rs:569:5:569:12 | mutate(...) | variables.rs:570:5:570:17 | ExprStmt | | -| variables.rs:569:5:569:13 | ExprStmt | variables.rs:569:5:569:10 | mutate | | -| variables.rs:570:5:570:14 | mutate_arg | variables.rs:570:5:570:16 | mutate_arg(...) | | -| variables.rs:570:5:570:16 | mutate_arg(...) | variables.rs:571:5:571:12 | ExprStmt | | -| variables.rs:570:5:570:17 | ExprStmt | variables.rs:570:5:570:14 | mutate_arg | | -| variables.rs:571:5:571:9 | alias | variables.rs:571:5:571:11 | alias(...) | | -| variables.rs:571:5:571:11 | alias(...) | variables.rs:572:5:572:18 | ExprStmt | | -| variables.rs:571:5:571:12 | ExprStmt | variables.rs:571:5:571:9 | alias | | -| variables.rs:572:5:572:15 | capture_mut | variables.rs:572:5:572:17 | capture_mut(...) | | -| variables.rs:572:5:572:17 | capture_mut(...) | variables.rs:573:5:573:20 | ExprStmt | | -| variables.rs:572:5:572:18 | ExprStmt | variables.rs:572:5:572:15 | capture_mut | | -| variables.rs:573:5:573:17 | capture_immut | variables.rs:573:5:573:19 | capture_immut(...) | | -| variables.rs:573:5:573:19 | capture_immut(...) | variables.rs:574:5:574:26 | ExprStmt | | -| variables.rs:573:5:573:20 | ExprStmt | variables.rs:573:5:573:17 | capture_immut | | -| variables.rs:574:5:574:23 | async_block_capture | variables.rs:574:5:574:25 | async_block_capture(...) | | -| variables.rs:574:5:574:25 | async_block_capture(...) | variables.rs:575:5:575:14 | ExprStmt | | -| variables.rs:574:5:574:26 | ExprStmt | variables.rs:574:5:574:23 | async_block_capture | | -| variables.rs:575:5:575:11 | structs | variables.rs:575:5:575:13 | structs(...) | | -| variables.rs:575:5:575:13 | structs(...) | variables.rs:576:5:576:14 | ExprStmt | | -| variables.rs:575:5:575:14 | ExprStmt | variables.rs:575:5:575:11 | structs | | -| variables.rs:576:5:576:11 | ref_arg | variables.rs:576:5:576:13 | ref_arg(...) | | -| variables.rs:576:5:576:13 | ref_arg(...) | variables.rs:577:5:577:30 | ExprStmt | | -| variables.rs:576:5:576:14 | ExprStmt | variables.rs:576:5:576:11 | ref_arg | | -| variables.rs:577:5:577:27 | ref_methodcall_receiver | variables.rs:577:5:577:29 | ref_methodcall_receiver(...) | | -| variables.rs:577:5:577:29 | ref_methodcall_receiver(...) | variables.rs:544:11:578:1 | { ... } | | -| variables.rs:577:5:577:30 | ExprStmt | variables.rs:577:5:577:27 | ref_methodcall_receiver | | +| variables.rs:553:1:557:1 | enter fn macro_invocation | variables.rs:554:5:555:26 | let ... = ... | | +| variables.rs:553:1:557:1 | exit fn macro_invocation (normal) | variables.rs:553:1:557:1 | exit fn macro_invocation | | +| variables.rs:553:23:557:1 | { ... } | variables.rs:553:1:557:1 | exit fn macro_invocation (normal) | | +| variables.rs:554:5:555:26 | let ... = ... | variables.rs:555:23:555:24 | let ... = 37 | | +| variables.rs:554:9:554:22 | var_from_macro | variables.rs:556:5:556:30 | ExprStmt | match | +| variables.rs:555:9:555:25 | MacroExpr | variables.rs:554:9:554:22 | var_from_macro | | +| variables.rs:555:9:555:25 | var_in_macro | variables.rs:555:9:555:25 | var_in_macro | match | +| variables.rs:555:9:555:25 | var_in_macro | variables.rs:555:23:555:24 | { ... } | | +| variables.rs:555:23:555:24 | 37 | variables.rs:555:9:555:25 | var_in_macro | | +| variables.rs:555:23:555:24 | let ... = 37 | variables.rs:555:23:555:24 | 37 | | +| variables.rs:555:23:555:24 | { ... } | variables.rs:555:9:555:25 | MacroExpr | | +| variables.rs:556:5:556:13 | print_i64 | variables.rs:556:15:556:28 | var_from_macro | | +| variables.rs:556:5:556:29 | print_i64(...) | variables.rs:553:23:557:1 | { ... } | | +| variables.rs:556:5:556:30 | ExprStmt | variables.rs:556:5:556:13 | print_i64 | | +| variables.rs:556:15:556:28 | var_from_macro | variables.rs:556:5:556:29 | print_i64(...) | | +| variables.rs:559:1:594:1 | enter fn main | variables.rs:560:5:560:25 | ExprStmt | | +| variables.rs:559:1:594:1 | exit fn main (normal) | variables.rs:559:1:594:1 | exit fn main | | +| variables.rs:559:11:594:1 | { ... } | variables.rs:559:1:594:1 | exit fn main (normal) | | +| variables.rs:560:5:560:22 | immutable_variable | variables.rs:560:5:560:24 | immutable_variable(...) | | +| variables.rs:560:5:560:24 | immutable_variable(...) | variables.rs:561:5:561:23 | ExprStmt | | +| variables.rs:560:5:560:25 | ExprStmt | variables.rs:560:5:560:22 | immutable_variable | | +| variables.rs:561:5:561:20 | mutable_variable | variables.rs:561:5:561:22 | mutable_variable(...) | | +| variables.rs:561:5:561:22 | mutable_variable(...) | variables.rs:562:5:562:40 | ExprStmt | | +| variables.rs:561:5:561:23 | ExprStmt | variables.rs:561:5:561:20 | mutable_variable | | +| variables.rs:562:5:562:37 | mutable_variable_immutable_borrow | variables.rs:562:5:562:39 | mutable_variable_immutable_borrow(...) | | +| variables.rs:562:5:562:39 | mutable_variable_immutable_borrow(...) | variables.rs:563:5:563:23 | ExprStmt | | +| variables.rs:562:5:562:40 | ExprStmt | variables.rs:562:5:562:37 | mutable_variable_immutable_borrow | | +| variables.rs:563:5:563:20 | variable_shadow1 | variables.rs:563:5:563:22 | variable_shadow1(...) | | +| variables.rs:563:5:563:22 | variable_shadow1(...) | variables.rs:564:5:564:23 | ExprStmt | | +| variables.rs:563:5:563:23 | ExprStmt | variables.rs:563:5:563:20 | variable_shadow1 | | +| variables.rs:564:5:564:20 | variable_shadow2 | variables.rs:564:5:564:22 | variable_shadow2(...) | | +| variables.rs:564:5:564:22 | variable_shadow2(...) | variables.rs:565:5:565:19 | ExprStmt | | +| variables.rs:564:5:564:23 | ExprStmt | variables.rs:564:5:564:20 | variable_shadow2 | | +| variables.rs:565:5:565:16 | let_pattern1 | variables.rs:565:5:565:18 | let_pattern1(...) | | +| variables.rs:565:5:565:18 | let_pattern1(...) | variables.rs:566:5:566:19 | ExprStmt | | +| variables.rs:565:5:565:19 | ExprStmt | variables.rs:565:5:565:16 | let_pattern1 | | +| variables.rs:566:5:566:16 | let_pattern2 | variables.rs:566:5:566:18 | let_pattern2(...) | | +| variables.rs:566:5:566:18 | let_pattern2(...) | variables.rs:567:5:567:19 | ExprStmt | | +| variables.rs:566:5:566:19 | ExprStmt | variables.rs:566:5:566:16 | let_pattern2 | | +| variables.rs:567:5:567:16 | let_pattern3 | variables.rs:567:5:567:18 | let_pattern3(...) | | +| variables.rs:567:5:567:18 | let_pattern3(...) | variables.rs:568:5:568:19 | ExprStmt | | +| variables.rs:567:5:567:19 | ExprStmt | variables.rs:567:5:567:16 | let_pattern3 | | +| variables.rs:568:5:568:16 | let_pattern4 | variables.rs:568:5:568:18 | let_pattern4(...) | | +| variables.rs:568:5:568:18 | let_pattern4(...) | variables.rs:569:5:569:21 | ExprStmt | | +| variables.rs:568:5:568:19 | ExprStmt | variables.rs:568:5:568:16 | let_pattern4 | | +| variables.rs:569:5:569:18 | match_pattern1 | variables.rs:569:5:569:20 | match_pattern1(...) | | +| variables.rs:569:5:569:20 | match_pattern1(...) | variables.rs:570:5:570:21 | ExprStmt | | +| variables.rs:569:5:569:21 | ExprStmt | variables.rs:569:5:569:18 | match_pattern1 | | +| variables.rs:570:5:570:18 | match_pattern2 | variables.rs:570:5:570:20 | match_pattern2(...) | | +| variables.rs:570:5:570:20 | match_pattern2(...) | variables.rs:571:5:571:21 | ExprStmt | | +| variables.rs:570:5:570:21 | ExprStmt | variables.rs:570:5:570:18 | match_pattern2 | | +| variables.rs:571:5:571:18 | match_pattern3 | variables.rs:571:5:571:20 | match_pattern3(...) | | +| variables.rs:571:5:571:20 | match_pattern3(...) | variables.rs:572:5:572:21 | ExprStmt | | +| variables.rs:571:5:571:21 | ExprStmt | variables.rs:571:5:571:18 | match_pattern3 | | +| variables.rs:572:5:572:18 | match_pattern4 | variables.rs:572:5:572:20 | match_pattern4(...) | | +| variables.rs:572:5:572:20 | match_pattern4(...) | variables.rs:573:5:573:21 | ExprStmt | | +| variables.rs:572:5:572:21 | ExprStmt | variables.rs:572:5:572:18 | match_pattern4 | | +| variables.rs:573:5:573:18 | match_pattern5 | variables.rs:573:5:573:20 | match_pattern5(...) | | +| variables.rs:573:5:573:20 | match_pattern5(...) | variables.rs:574:5:574:21 | ExprStmt | | +| variables.rs:573:5:573:21 | ExprStmt | variables.rs:573:5:573:18 | match_pattern5 | | +| variables.rs:574:5:574:18 | match_pattern6 | variables.rs:574:5:574:20 | match_pattern6(...) | | +| variables.rs:574:5:574:20 | match_pattern6(...) | variables.rs:575:5:575:21 | ExprStmt | | +| variables.rs:574:5:574:21 | ExprStmt | variables.rs:574:5:574:18 | match_pattern6 | | +| variables.rs:575:5:575:18 | match_pattern7 | variables.rs:575:5:575:20 | match_pattern7(...) | | +| variables.rs:575:5:575:20 | match_pattern7(...) | variables.rs:576:5:576:21 | ExprStmt | | +| variables.rs:575:5:575:21 | ExprStmt | variables.rs:575:5:575:18 | match_pattern7 | | +| variables.rs:576:5:576:18 | match_pattern8 | variables.rs:576:5:576:20 | match_pattern8(...) | | +| variables.rs:576:5:576:20 | match_pattern8(...) | variables.rs:577:5:577:21 | ExprStmt | | +| variables.rs:576:5:576:21 | ExprStmt | variables.rs:576:5:576:18 | match_pattern8 | | +| variables.rs:577:5:577:18 | match_pattern9 | variables.rs:577:5:577:20 | match_pattern9(...) | | +| variables.rs:577:5:577:20 | match_pattern9(...) | variables.rs:578:5:578:36 | ExprStmt | | +| variables.rs:577:5:577:21 | ExprStmt | variables.rs:577:5:577:18 | match_pattern9 | | +| variables.rs:578:5:578:18 | param_pattern1 | variables.rs:578:20:578:22 | "a" | | +| variables.rs:578:5:578:35 | param_pattern1(...) | variables.rs:579:5:579:37 | ExprStmt | | +| variables.rs:578:5:578:36 | ExprStmt | variables.rs:578:5:578:18 | param_pattern1 | | +| variables.rs:578:20:578:22 | "a" | variables.rs:578:26:578:28 | "b" | | +| variables.rs:578:25:578:34 | TupleExpr | variables.rs:578:5:578:35 | param_pattern1(...) | | +| variables.rs:578:26:578:28 | "b" | variables.rs:578:31:578:33 | "c" | | +| variables.rs:578:31:578:33 | "c" | variables.rs:578:25:578:34 | TupleExpr | | +| variables.rs:579:5:579:18 | param_pattern2 | variables.rs:579:20:579:31 | ...::Left | | +| variables.rs:579:5:579:36 | param_pattern2(...) | variables.rs:580:5:580:26 | ExprStmt | | +| variables.rs:579:5:579:37 | ExprStmt | variables.rs:579:5:579:18 | param_pattern2 | | +| variables.rs:579:20:579:31 | ...::Left | variables.rs:579:33:579:34 | 45 | | +| variables.rs:579:20:579:35 | ...::Left(...) | variables.rs:579:5:579:36 | param_pattern2(...) | | +| variables.rs:579:33:579:34 | 45 | variables.rs:579:20:579:35 | ...::Left(...) | | +| variables.rs:580:5:580:23 | destruct_assignment | variables.rs:580:5:580:25 | destruct_assignment(...) | | +| variables.rs:580:5:580:25 | destruct_assignment(...) | variables.rs:581:5:581:23 | ExprStmt | | +| variables.rs:580:5:580:26 | ExprStmt | variables.rs:580:5:580:23 | destruct_assignment | | +| variables.rs:581:5:581:20 | closure_variable | variables.rs:581:5:581:22 | closure_variable(...) | | +| variables.rs:581:5:581:22 | closure_variable(...) | variables.rs:582:5:582:19 | ExprStmt | | +| variables.rs:581:5:581:23 | ExprStmt | variables.rs:581:5:581:20 | closure_variable | | +| variables.rs:582:5:582:16 | for_variable | variables.rs:582:5:582:18 | for_variable(...) | | +| variables.rs:582:5:582:18 | for_variable(...) | variables.rs:583:5:583:17 | ExprStmt | | +| variables.rs:582:5:582:19 | ExprStmt | variables.rs:582:5:582:16 | for_variable | | +| variables.rs:583:5:583:14 | add_assign | variables.rs:583:5:583:16 | add_assign(...) | | +| variables.rs:583:5:583:16 | add_assign(...) | variables.rs:584:5:584:13 | ExprStmt | | +| variables.rs:583:5:583:17 | ExprStmt | variables.rs:583:5:583:14 | add_assign | | +| variables.rs:584:5:584:10 | mutate | variables.rs:584:5:584:12 | mutate(...) | | +| variables.rs:584:5:584:12 | mutate(...) | variables.rs:585:5:585:17 | ExprStmt | | +| variables.rs:584:5:584:13 | ExprStmt | variables.rs:584:5:584:10 | mutate | | +| variables.rs:585:5:585:14 | mutate_arg | variables.rs:585:5:585:16 | mutate_arg(...) | | +| variables.rs:585:5:585:16 | mutate_arg(...) | variables.rs:586:5:586:12 | ExprStmt | | +| variables.rs:585:5:585:17 | ExprStmt | variables.rs:585:5:585:14 | mutate_arg | | +| variables.rs:586:5:586:9 | alias | variables.rs:586:5:586:11 | alias(...) | | +| variables.rs:586:5:586:11 | alias(...) | variables.rs:587:5:587:18 | ExprStmt | | +| variables.rs:586:5:586:12 | ExprStmt | variables.rs:586:5:586:9 | alias | | +| variables.rs:587:5:587:15 | capture_mut | variables.rs:587:5:587:17 | capture_mut(...) | | +| variables.rs:587:5:587:17 | capture_mut(...) | variables.rs:588:5:588:20 | ExprStmt | | +| variables.rs:587:5:587:18 | ExprStmt | variables.rs:587:5:587:15 | capture_mut | | +| variables.rs:588:5:588:17 | capture_immut | variables.rs:588:5:588:19 | capture_immut(...) | | +| variables.rs:588:5:588:19 | capture_immut(...) | variables.rs:589:5:589:26 | ExprStmt | | +| variables.rs:588:5:588:20 | ExprStmt | variables.rs:588:5:588:17 | capture_immut | | +| variables.rs:589:5:589:23 | async_block_capture | variables.rs:589:5:589:25 | async_block_capture(...) | | +| variables.rs:589:5:589:25 | async_block_capture(...) | variables.rs:590:5:590:14 | ExprStmt | | +| variables.rs:589:5:589:26 | ExprStmt | variables.rs:589:5:589:23 | async_block_capture | | +| variables.rs:590:5:590:11 | structs | variables.rs:590:5:590:13 | structs(...) | | +| variables.rs:590:5:590:13 | structs(...) | variables.rs:591:5:591:14 | ExprStmt | | +| variables.rs:590:5:590:14 | ExprStmt | variables.rs:590:5:590:11 | structs | | +| variables.rs:591:5:591:11 | ref_arg | variables.rs:591:5:591:13 | ref_arg(...) | | +| variables.rs:591:5:591:13 | ref_arg(...) | variables.rs:592:5:592:30 | ExprStmt | | +| variables.rs:591:5:591:14 | ExprStmt | variables.rs:591:5:591:11 | ref_arg | | +| variables.rs:592:5:592:27 | ref_methodcall_receiver | variables.rs:592:5:592:29 | ref_methodcall_receiver(...) | | +| variables.rs:592:5:592:29 | ref_methodcall_receiver(...) | variables.rs:593:5:593:23 | ExprStmt | | +| variables.rs:592:5:592:30 | ExprStmt | variables.rs:592:5:592:27 | ref_methodcall_receiver | | +| variables.rs:593:5:593:20 | macro_invocation | variables.rs:593:5:593:22 | macro_invocation(...) | | +| variables.rs:593:5:593:22 | macro_invocation(...) | variables.rs:559:11:594:1 | { ... } | | +| variables.rs:593:5:593:23 | ExprStmt | variables.rs:593:5:593:20 | macro_invocation | | breakTarget continueTarget diff --git a/rust/ql/test/library-tests/variables/Ssa.expected b/rust/ql/test/library-tests/variables/Ssa.expected index 6736f87d709f..6d3a2abe8863 100644 --- a/rust/ql/test/library-tests/variables/Ssa.expected +++ b/rust/ql/test/library-tests/variables/Ssa.expected @@ -145,6 +145,7 @@ definition | variables.rs:519:9:519:9 | x | variables.rs:519:9:519:9 | x | | variables.rs:523:9:523:9 | z | variables.rs:523:9:523:9 | z | | variables.rs:532:10:532:18 | SelfParam | variables.rs:532:15:532:18 | self | +| variables.rs:554:9:554:22 | var_from_macro | variables.rs:554:9:554:22 | var_from_macro | read | variables.rs:3:14:3:14 | s | variables.rs:3:14:3:14 | s | variables.rs:4:20:4:20 | s | | variables.rs:7:14:7:14 | i | variables.rs:7:14:7:14 | i | variables.rs:8:20:8:20 | i | @@ -282,6 +283,7 @@ read | variables.rs:519:9:519:9 | x | variables.rs:519:9:519:9 | x | variables.rs:521:15:521:15 | x | | variables.rs:523:9:523:9 | z | variables.rs:523:9:523:9 | z | variables.rs:524:20:524:20 | z | | variables.rs:532:10:532:18 | SelfParam | variables.rs:532:15:532:18 | self | variables.rs:533:6:533:9 | self | +| variables.rs:554:9:554:22 | var_from_macro | variables.rs:554:9:554:22 | var_from_macro | variables.rs:556:15:556:28 | var_from_macro | firstRead | variables.rs:3:14:3:14 | s | variables.rs:3:14:3:14 | s | variables.rs:4:20:4:20 | s | | variables.rs:7:14:7:14 | i | variables.rs:7:14:7:14 | i | variables.rs:8:20:8:20 | i | @@ -392,6 +394,7 @@ firstRead | variables.rs:519:9:519:9 | x | variables.rs:519:9:519:9 | x | variables.rs:520:20:520:20 | x | | variables.rs:523:9:523:9 | z | variables.rs:523:9:523:9 | z | variables.rs:524:20:524:20 | z | | variables.rs:532:10:532:18 | SelfParam | variables.rs:532:15:532:18 | self | variables.rs:533:6:533:9 | self | +| variables.rs:554:9:554:22 | var_from_macro | variables.rs:554:9:554:22 | var_from_macro | variables.rs:556:15:556:28 | var_from_macro | lastRead | variables.rs:3:14:3:14 | s | variables.rs:3:14:3:14 | s | variables.rs:4:20:4:20 | s | | variables.rs:7:14:7:14 | i | variables.rs:7:14:7:14 | i | variables.rs:8:20:8:20 | i | @@ -503,6 +506,7 @@ lastRead | variables.rs:519:9:519:9 | x | variables.rs:519:9:519:9 | x | variables.rs:521:15:521:15 | x | | variables.rs:523:9:523:9 | z | variables.rs:523:9:523:9 | z | variables.rs:524:20:524:20 | z | | variables.rs:532:10:532:18 | SelfParam | variables.rs:532:15:532:18 | self | variables.rs:533:6:533:9 | self | +| variables.rs:554:9:554:22 | var_from_macro | variables.rs:554:9:554:22 | var_from_macro | variables.rs:556:15:556:28 | var_from_macro | adjacentReads | variables.rs:35:9:35:10 | x3 | variables.rs:35:9:35:10 | x3 | variables.rs:36:15:36:16 | x3 | variables.rs:38:9:38:10 | x3 | | variables.rs:43:9:43:10 | x4 | variables.rs:43:9:43:10 | x4 | variables.rs:44:15:44:16 | x4 | variables.rs:49:15:49:16 | x4 | @@ -654,3 +658,4 @@ assigns | variables.rs:514:5:514:5 | a | variables.rs:514:9:514:17 | [...] | | variables.rs:519:9:519:9 | x | variables.rs:519:13:519:14 | 16 | | variables.rs:523:9:523:9 | z | variables.rs:523:13:523:14 | 17 | +| variables.rs:554:9:554:22 | var_from_macro | variables.rs:555:9:555:25 | MacroExpr | diff --git a/rust/ql/test/library-tests/variables/variables.expected b/rust/ql/test/library-tests/variables/variables.expected index 1e3fc90633ce..7d1583aff773 100644 --- a/rust/ql/test/library-tests/variables/variables.expected +++ b/rust/ql/test/library-tests/variables/variables.expected @@ -105,6 +105,8 @@ variable | variables.rs:523:9:523:9 | z | | variables.rs:532:15:532:18 | self | | variables.rs:538:11:538:11 | a | +| variables.rs:554:9:554:22 | var_from_macro | +| variables.rs:555:9:555:25 | var_in_macro | variableAccess | variables.rs:4:20:4:20 | s | variables.rs:3:14:3:14 | s | | variables.rs:8:20:8:20 | i | variables.rs:7:14:7:14 | i | @@ -274,6 +276,7 @@ variableAccess | variables.rs:533:6:533:9 | self | variables.rs:532:15:532:18 | self | | variables.rs:539:3:539:3 | a | variables.rs:538:11:538:11 | a | | variables.rs:541:13:541:13 | a | variables.rs:538:11:538:11 | a | +| variables.rs:556:15:556:28 | var_from_macro | variables.rs:554:9:554:22 | var_from_macro | variableWriteAccess | variables.rs:23:5:23:6 | x2 | variables.rs:21:13:21:14 | x2 | | variables.rs:30:5:30:5 | x | variables.rs:28:13:28:13 | x | @@ -433,6 +436,7 @@ variableReadAccess | variables.rs:533:6:533:9 | self | variables.rs:532:15:532:18 | self | | variables.rs:539:3:539:3 | a | variables.rs:538:11:538:11 | a | | variables.rs:541:13:541:13 | a | variables.rs:538:11:538:11 | a | +| variables.rs:556:15:556:28 | var_from_macro | variables.rs:554:9:554:22 | var_from_macro | variableInitializer | variables.rs:16:9:16:10 | x1 | variables.rs:16:14:16:16 | "a" | | variables.rs:21:13:21:14 | x2 | variables.rs:21:18:21:18 | 4 | @@ -486,6 +490,8 @@ variableInitializer | variables.rs:519:9:519:9 | x | variables.rs:519:13:519:14 | 16 | | variables.rs:523:9:523:9 | z | variables.rs:523:13:523:14 | 17 | | variables.rs:538:11:538:11 | a | variables.rs:538:15:538:33 | MyStruct {...} | +| variables.rs:554:9:554:22 | var_from_macro | variables.rs:555:9:555:25 | MacroExpr | +| variables.rs:555:9:555:25 | var_in_macro | variables.rs:555:23:555:24 | 37 | capturedVariable | variables.rs:400:9:400:9 | x | | variables.rs:410:13:410:13 | x | diff --git a/rust/ql/test/library-tests/variables/variables.rs b/rust/ql/test/library-tests/variables/variables.rs index 155ebaa8584a..b6a250fba87c 100644 --- a/rust/ql/test/library-tests/variables/variables.rs +++ b/rust/ql/test/library-tests/variables/variables.rs @@ -541,6 +541,21 @@ fn ref_methodcall_receiver() { print_i64(a.val); // $ read_access=a } +macro_rules! let_in_macro { + ($e:expr) => { + { + let var_in_macro = $e; + var_in_macro + } + }; +} + +fn macro_invocation() { + let var_from_macro = + let_in_macro!(37); // $ MISSING: read_access=var_in_macro + print_i64(var_from_macro); // $ read_access=var_from_macro +} + fn main() { immutable_variable(); mutable_variable(); @@ -575,4 +590,5 @@ fn main() { structs(); ref_arg(); ref_methodcall_receiver(); + macro_invocation(); }