]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: libproc_macro: Add drop function to Literal struct
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 12 Apr 2023 15:56:36 +0000 (17:56 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:34:11 +0000 (18:34 +0100)
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>
libgrust/libproc_macro/literal.cc
libgrust/libproc_macro/literal.h

index aad7090d7ab3c196ad87aee45ab150dd339b32e8..221c57a0da5e9ddd9e796c614eab623a1786d835 100644 (file)
 #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)
 {
index b789422210533d7a7b6125f7bf1b5f5c9acd320f..2c61231e8b25ae80849933b36f31a9460d41a4b7 100644 (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" {