aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-fmt.cc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-01-30 01:48:13 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-08-01 13:11:29 +0200
commit6e04e69bff8e92a8df0f7663f9f7d3aac1b7fd31 (patch)
treeab2ebadb92378a4af58f11e5b46d7cf7c3c69c5b /gcc/rust/ast/rust-fmt.cc
parentd6332141d714888b53c1973f2d89ee24e422cb62 (diff)
downloadgcc-6e04e69bff8e92a8df0f7663f9f7d3aac1b7fd31.zip
gcc-6e04e69bff8e92a8df0f7663f9f7d3aac1b7fd31.tar.gz
gcc-6e04e69bff8e92a8df0f7663f9f7d3aac1b7fd31.tar.bz2
gccrs: libformat_parser: Send boxed values across FFI properly
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::~Pieces): Call libformat_parser's release function in destructor. * ast/rust-fmt.h (struct PieceSlice): Add capacity. (destroy_pieces): New. (struct Pieces): Add destructor. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Leak Boxes properly for C++ to see them, add memory release function.
Diffstat (limited to 'gcc/rust/ast/rust-fmt.cc')
-rw-r--r--gcc/rust/ast/rust-fmt.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/rust/ast/rust-fmt.cc b/gcc/rust/ast/rust-fmt.cc
index a7c4341..f6ee8a2 100644
--- a/gcc/rust/ast/rust-fmt.cc
+++ b/gcc/rust/ast/rust-fmt.cc
@@ -34,8 +34,10 @@ Pieces::collect (const std::string &to_parse)
// auto pieces = std::vector<Piece> (piece_slice.base_ptr,
// piece_slice.base_ptr + piece_slice.len);
- return Pieces{};
+ return Pieces (piece_slice);
}
+Pieces::~Pieces () { destroy_pieces (slice); }
+
} // namespace Fmt
} // namespace Rust