From: Pierre-Emmanuel Patry Date: Wed, 12 Apr 2023 15:56:36 +0000 (+0200) Subject: gccrs: libproc_macro: Add drop function to Literal struct X-Git-Tag: basepoints/gcc-15~2632 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fa0bbc3ee6551e1cf67408ef2ce7673177303e7;p=thirdparty%2Fgcc.git gccrs: libproc_macro: Add drop function to Literal struct Add a drop function to clean internal fields of a Literal struct. libgrust/ChangeLog: * libproc_macro/literal.cc (Literal__drop): Replace implementation by a call to Literal::drop. (Literal::drop): Add drop implementation. * libproc_macro/literal.h: Add function prototype. Signed-off-by: Pierre-Emmanuel Patry --- diff --git a/libgrust/libproc_macro/literal.cc b/libgrust/libproc_macro/literal.cc index aad7090d7ab3..221c57a0da5e 100644 --- a/libgrust/libproc_macro/literal.cc +++ b/libgrust/libproc_macro/literal.cc @@ -25,10 +25,9 @@ #include namespace Literal { -extern "C" { void -Literal__drop (Literal *lit) +Literal::drop (Literal *lit) { switch (lit->tag) { @@ -51,6 +50,14 @@ Literal__drop (Literal *lit) } } +extern "C" { + +void +Literal__drop (Literal *lit) +{ + Literal::drop (lit); +} + Literal Literal__string (const unsigned char *str, std::uint64_t len) { diff --git a/libgrust/libproc_macro/literal.h b/libgrust/libproc_macro/literal.h index b78942221053..2c61231e8b25 100644 --- a/libgrust/libproc_macro/literal.h +++ b/libgrust/libproc_macro/literal.h @@ -188,6 +188,8 @@ public: static Literal make_unsigned (UnsignedSuffixPayload p); static Literal make_signed (SignedSuffixPayload p); + + static void drop (Literal *lit); }; extern "C" {