aboutsummaryrefslogtreecommitdiff
path: root/libgrust
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-07-26 15:39:25 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:55:59 +0100
commit973f4088efa74e3c181169b77c22358ae179d4d6 (patch)
treeddaf5e622d0d7f8bff9f1a119f71813f7449c0cc /libgrust
parentf00f3837ef1317b46a6b1a458140e98d0d18fd4d (diff)
downloadgcc-973f4088efa74e3c181169b77c22358ae179d4d6.zip
gcc-973f4088efa74e3c181169b77c22358ae179d4d6.tar.gz
gcc-973f4088efa74e3c181169b77c22358ae179d4d6.tar.bz2
gccrs: proc_macro: Mirror FFIString changes in C++library
Recent changes in the rust interface on some extern C function shall be synced up in the C++ library. libgrust/ChangeLog: * libproc_macro/literal.cc (Literal__from_string): Update to match rust interface. * libproc_macro/literal.h (Literal__from_string): Likewise. * libproc_macro/tokenstream.cc (TokenStream__from_string): Likewise. * libproc_macro/tokenstream.h (TokenStream__from_string): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'libgrust')
-rw-r--r--libgrust/libproc_macro/literal.cc2
-rw-r--r--libgrust/libproc_macro/literal.h3
-rw-r--r--libgrust/libproc_macro/tokenstream.cc5
-rw-r--r--libgrust/libproc_macro/tokenstream.h5
4 files changed, 7 insertions, 8 deletions
diff --git a/libgrust/libproc_macro/literal.cc b/libgrust/libproc_macro/literal.cc
index 4ad45c9..8e1e0a4 100644
--- a/libgrust/libproc_macro/literal.cc
+++ b/libgrust/libproc_macro/literal.cc
@@ -28,7 +28,7 @@ namespace ProcMacro {
extern "C" {
bool
-Literal__from_string (const unsigned char *str, std::uint64_t len, Literal *lit)
+Literal__from_string (FFIString str, Literal *lit)
{
// FIXME: implement this function with lexer
std::abort ();
diff --git a/libgrust/libproc_macro/literal.h b/libgrust/libproc_macro/literal.h
index e1b7079..fb8a8b4 100644
--- a/libgrust/libproc_macro/literal.h
+++ b/libgrust/libproc_macro/literal.h
@@ -105,8 +105,7 @@ public:
extern "C" {
bool
-Literal__from_string (const unsigned char *str, std::uint64_t len,
- Literal *lit);
+Literal__from_string (FFIString str, Literal *lit);
}
} // namespace ProcMacro
diff --git a/libgrust/libproc_macro/tokenstream.cc b/libgrust/libproc_macro/tokenstream.cc
index c3502f1..5d9abb6 100644
--- a/libgrust/libproc_macro/tokenstream.cc
+++ b/libgrust/libproc_macro/tokenstream.cc
@@ -103,11 +103,10 @@ TokenSream__push (TokenStream *stream, TokenTree tree)
}
extern "C" bool
-TokenStream__from_string (unsigned char *str, std::uint64_t len,
- TokenStream *ts)
+TokenStream__from_string (FFIString str, TokenStream *ts)
{
bool result;
- auto source = std::string (reinterpret_cast<const char *> (str), len);
+ auto source = str.to_string ();
*ts = TokenStream::make_tokenstream (source, result);
return result;
diff --git a/libgrust/libproc_macro/tokenstream.h b/libgrust/libproc_macro/tokenstream.h
index 8b2432b..0fde5ea 100644
--- a/libgrust/libproc_macro/tokenstream.h
+++ b/libgrust/libproc_macro/tokenstream.h
@@ -27,6 +27,8 @@
#include <vector>
#include <string>
+#include "ffistring.h"
+
namespace ProcMacro {
struct TokenTree;
@@ -59,8 +61,7 @@ extern "C" void
TokenSream__push (TokenStream *stream, TokenTree tree);
extern "C" bool
-TokenStream__from_string (unsigned char *str, std::uint64_t len,
- TokenStream *ts);
+TokenStream__from_string (FFIString str, TokenStream *ts);
extern "C" TokenStream
TokenStream__clone (const TokenStream *ts);