From 4332fbfaec8b6b66efa737c92d191003a76264bf Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Wed, 19 Jul 2023 11:50:23 +0200 Subject: libproc_macro: Change Ident structure Use FFIString in Ident structure rather that a raw pointer and a length, this will reduce the size of the code dealing with raw pointers. Which should prevent some error. gcc/rust/ChangeLog: * util/rust-token-converter.cc (from_ident): Adapt code to new constructor. ChangeLog: * libgrust/libproc_macro/ident.cc (Ident__new): Constructor accepts an FFIString now. (Ident__new_raw): Likewise. (Ident::clone): Internal members change means clone also change. (Ident::make_ident): Change constructor call. (Ident::drop): Add call to FFIString::clone. * libgrust/libproc_macro/ident.h (struct Ident): Remove raw pointer and length, add an FFIString inside instead. (Ident__new): Change constructor. (Ident__new_raw): Change constructor. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/util/rust-token-converter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/rust') diff --git a/gcc/rust/util/rust-token-converter.cc b/gcc/rust/util/rust-token-converter.cc index 3206ced..ffda24e 100644 --- a/gcc/rust/util/rust-token-converter.cc +++ b/gcc/rust/util/rust-token-converter.cc @@ -269,7 +269,7 @@ from_tokenstream (const ProcMacro::TokenStream &ts, static void from_ident (const ProcMacro::Ident &ident, std::vector &result) { - std::string value (reinterpret_cast (ident.val), ident.len); + std::string value (ident.value.to_string ()); if (ident.is_raw) value = "r#" + value; -- cgit v1.1