aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-07-07 13:54:53 +0000
committerGitHub <noreply@github.com>2022-07-07 13:54:53 +0000
commitd4dda7805fc333af269d5c8cf829aa2e66acfc57 (patch)
tree1603981f6e786c1914d11ad610cd10d2658473ef /gcc/rust/ast
parent98b3f9bca253d1ecfae6fb94d255d8e991e4b92c (diff)
parentec5da37dbfbcc55183f7ea4658c8856b9335ad61 (diff)
downloadgcc-d4dda7805fc333af269d5c8cf829aa2e66acfc57.zip
gcc-d4dda7805fc333af269d5c8cf829aa2e66acfc57.tar.gz
gcc-d4dda7805fc333af269d5c8cf829aa2e66acfc57.tar.bz2
Merge #1363
1363: Refactor Lexer to support an abstract InputSource class r=philberty a=philberty This patch allows us to remove the fmemopen lex_string hack to support parsing buffers. This will allow us to support mutliple sources such as metadata imports etc. The patch here updates the parser to hold onto a reference to the lexer rather than 'owning' the lexer which allows us to decouple the move semantics here. Fixes #1203 Fixes #1000 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/ast')
-rw-r--r--gcc/rust/ast/rust-ast-full-test.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/gcc/rust/ast/rust-ast-full-test.cc b/gcc/rust/ast/rust-ast-full-test.cc
index 6c41d13..25ec6db 100644
--- a/gcc/rust/ast/rust-ast-full-test.cc
+++ b/gcc/rust/ast/rust-ast-full-test.cc
@@ -4044,8 +4044,7 @@ Module::load_items ()
RAIIFile file_wrap (module_file.c_str ());
Linemap *linemap = Session::get_instance ().linemap;
-
- if (file_wrap.get_raw () == nullptr)
+ if (!file_wrap.ok ())
{
rust_error_at (get_locus (), "cannot open module file %s: %m",
module_file.c_str ());
@@ -4055,10 +4054,9 @@ Module::load_items ()
rust_debug ("Attempting to parse file %s", module_file.c_str ());
Lexer lex (module_file.c_str (), std::move (file_wrap), linemap);
- Parser<Lexer> parser (std::move (lex));
+ Parser<Lexer> parser (lex);
auto parsed_items = parser.parse_items ();
-
for (const auto &error : parser.get_errors ())
error.emit_error ();