]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Create LocalVariable
authorOwen Avery <powerboat9.gamer@gmail.com>
Sat, 28 Jun 2025 01:44:01 +0000 (21:44 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 25 Nov 2025 22:00:50 +0000 (23:00 +0100)
commitb03ebbb77dd4385048ef2df808445d8312e9246f
tree4690d80aa76793baf019d777eb96702a7dd1a47c
parenta9598bd3581b9349ccfe83e338fb18dbfd1aa1d1
gccrs: Create LocalVariable

This should make it easier for us to move away from leaking pointers to
Bvariable everywhere. Since LocalVariable has a single field of type
tree, it should be the same size as a pointer to Bvariable, making the
switch to LocalVariable wherever possible strictly an improvement.

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit): Implicitly
convert LocalVariable to pointer to Bvariable.
* rust-backend.h (local_variable): Return LocalVariable.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(temporary_variable): Likewise.
* rust-gcc.cc (local_variable): Likewise.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(temporary_variable): Likewise.
(LocalVariable::get_tree): New function.
(LocalVariable::error_variable): Likewise.
* rust-gcc.h (class LocalVariable): New class.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/backend/rust-compile-expr.cc
gcc/rust/rust-backend.h
gcc/rust/rust-gcc.cc
gcc/rust/rust-gcc.h