diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-05-05 17:16:08 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-05-08 14:53:18 +0000 |
commit | a252a9c12d7cc6cb160a57b271d2c8e8840b7f55 (patch) | |
tree | 17ff37108148a6c5b60f94e87db6db768bb21e25 | |
parent | 85ca0ba82084a19707912009d713aa58ef775621 (diff) | |
download | gcc-a252a9c12d7cc6cb160a57b271d2c8e8840b7f55.zip gcc-a252a9c12d7cc6cb160a57b271d2c8e8840b7f55.tar.gz gcc-a252a9c12d7cc6cb160a57b271d2c8e8840b7f55.tar.bz2 |
gccrs: Fix ICE in check for unused global variables
Calling get variable expression will return an expression but we are
checking for unused decls so lets actually pass the decl.
Addresses #2188
gcc/rust/ChangeLog:
* checks/lints/rust-lint-unused-var.cc (UnusedVariables::Lint): use the decl not the expr
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
-rw-r--r-- | gcc/rust/checks/lints/rust-lint-unused-var.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/rust/checks/lints/rust-lint-unused-var.cc b/gcc/rust/checks/lints/rust-lint-unused-var.cc index ba5ffb937..8837d8b 100644 --- a/gcc/rust/checks/lints/rust-lint-unused-var.cc +++ b/gcc/rust/checks/lints/rust-lint-unused-var.cc @@ -17,7 +17,7 @@ // <http://www.gnu.org/licenses/>. #include "rust-lint-unused-var.h" -#include "print-tree.h" +#include "rust-gcc.h" namespace Rust { namespace Analysis { @@ -84,8 +84,8 @@ UnusedVariables::Lint (Compile::Context &ctx) for (auto &var : ctx.get_var_decls ()) { - tree t = ctx.get_backend ()->var_expression (var, Location ()); - check_decl (&t); + tree decl = var->get_decl (); + check_decl (&decl); } for (auto &const_decl : ctx.get_const_decls ()) |