mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
gccrs: libproc_macro: Add drop function on Ident struct
Add a drop function that cleans internal fields of a given Ident struct. libgrust/ChangeLog: * libproc_macro/ident.cc (Ident__drop): Replace by call to Ident::drop. (Ident::drop): Add drop function. * libproc_macro/ident.h: Add drop prototype. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
This commit is contained in:
committed by
Arthur Cohen
parent
d9473a5b55
commit
c9534eb5d9
@@ -42,7 +42,7 @@ Ident__new_raw (unsigned char *str, std::uint64_t len)
|
||||
void
|
||||
Ident__drop (Ident *ident)
|
||||
{
|
||||
delete[] ident->val;
|
||||
Ident::drop (ident);
|
||||
}
|
||||
|
||||
Ident
|
||||
@@ -76,4 +76,11 @@ Ident::make_ident (const unsigned char *str, std::uint64_t len, bool raw)
|
||||
return {raw, val, len};
|
||||
}
|
||||
|
||||
void
|
||||
Ident::drop (Ident *ident)
|
||||
{
|
||||
delete[] ident->val;
|
||||
ident->len = 0;
|
||||
}
|
||||
|
||||
} // namespace Ident
|
||||
|
||||
@@ -41,6 +41,8 @@ public:
|
||||
static Ident make_ident (std::string str, bool raw = false);
|
||||
static Ident make_ident (const unsigned char *str, std::uint64_t len,
|
||||
bool raw = false);
|
||||
|
||||
static void drop (Ident *ident);
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
Reference in New Issue
Block a user