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 <pierre-emmanuel.patry@embecosm.com>
This commit is contained in:
Pierre-Emmanuel Patry 2023-04-12 17:56:36 +02:00 committed by Arthur Cohen
parent c9534eb5d9
commit 2fa0bbc3ee
2 changed files with 11 additions and 2 deletions

View File

@ -25,10 +25,9 @@
#include <cstdlib>
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)
{

View File

@ -188,6 +188,8 @@ public:
static Literal make_unsigned (UnsignedSuffixPayload p);
static Literal make_signed (SignedSuffixPayload p);
static void drop (Literal *lit);
};
extern "C" {