diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-02-16 18:27:22 +0100 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-03-01 15:42:36 +0000 |
commit | afed72d7137afe4ab4c7db44262379ba6dda4eb9 (patch) | |
tree | 24d8b8c13d34bd86db7094b134e19e255def747e /gcc/rust/ast/rust-fmt.h | |
parent | 38e3cffdbdee48cc4793948f1551b075672f6fdd (diff) | |
download | gcc-afed72d7137afe4ab4c7db44262379ba6dda4eb9.zip gcc-afed72d7137afe4ab4c7db44262379ba6dda4eb9.tar.gz gcc-afed72d7137afe4ab4c7db44262379ba6dda4eb9.tar.bz2 |
format-args: Fix Rust interface and add input parsing.
gcc/rust/ChangeLog:
* Make-lang.in: Do not build Rust library in release mode.
* ast/rust-ast.cc: Make FormatArgs inherit from AST::Expr
* ast/rust-builtin-ast-nodes.h: Improve FormatArg* nodes and helpers.
* ast/rust-fmt.cc (Pieces::collect): Fix interface to match FFI function.
* ast/rust-fmt.h (collect_pieces): Likewise.
(struct Pieces): Add append_newline parameter.
* expand/rust-macro-builtins.cc: Add proper parsing of format_args
input.
* hir/rust-ast-lower-base.cc: Include diagnostics header.
libgrust/ChangeLog:
* libformat_parser/src/lib.rs: Switch interface to use more parser
parameters.
* libformat_parser/src/bin.rs: Use new interface.
Diffstat (limited to 'gcc/rust/ast/rust-fmt.h')
-rw-r--r-- | gcc/rust/ast/rust-fmt.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/rust/ast/rust-fmt.h b/gcc/rust/ast/rust-fmt.h index 0bf9695..22447c4 100644 --- a/gcc/rust/ast/rust-fmt.h +++ b/gcc/rust/ast/rust-fmt.h @@ -222,7 +222,7 @@ struct Piece struct NextArgument_Body { - const Argument *_0; + Argument _0; }; Tag tag; @@ -243,7 +243,10 @@ struct PieceSlice extern "C" { PieceSlice -collect_pieces (const char *input); +collect_pieces (const char *input, bool append_newline); + +PieceSlice +clone_pieces (const Piece *base_ptr, size_t len, size_t cap); void destroy_pieces (PieceSlice); @@ -251,9 +254,21 @@ void destroy_pieces (PieceSlice); struct Pieces { - static Pieces collect (std::string &&to_parse); + static Pieces collect (std::string &&to_parse, bool append_newline); ~Pieces (); + Pieces (const Pieces &other); + Pieces &operator= (const Pieces &other); + + Pieces (Pieces &&other); + + // { + // slice = clone_pieces (&other.slice); + // to_parse = other.to_parse; + + // return *this; + // } + private: Pieces (PieceSlice slice, std::string &&to_parse) : slice (slice), to_parse (std::move (to_parse)) |