diff options
author | David Faust <david.faust@oracle.com> | 2022-01-14 09:56:56 -0800 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2022-01-14 10:28:11 -0800 |
commit | 7d456b882a8f72b6fb3bdb0e71367811770b4413 (patch) | |
tree | 83fd67a961ce521c6350e9c47bcbe3aa94965751 /gcc/rust/backend | |
parent | b21caeb3af4313016afeb94a91956e8fc4c2656d (diff) | |
download | gcc-7d456b882a8f72b6fb3bdb0e71367811770b4413.zip gcc-7d456b882a8f72b6fb3bdb0e71367811770b4413.tar.gz gcc-7d456b882a8f72b6fb3bdb0e71367811770b4413.tar.bz2 |
Track end locus of BlockExpr
Capture the closing locus of a block during parsing, and remove the old
hack to get the final statement locus within the block now that it is
properly tracked.
Fixes #864
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r-- | gcc/rust/backend/rust-compile-implitem.h | 4 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 4 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile.cc | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h index 5f4d879..7bef6ae 100644 --- a/gcc/rust/backend/rust-compile-implitem.h +++ b/gcc/rust/backend/rust-compile-implitem.h @@ -264,7 +264,7 @@ public: tree enclosing_scope = NULL_TREE; HIR::BlockExpr *function_body = function.get_definition ().get (); Location start_location = function_body->get_locus (); - Location end_location = function_body->get_closing_locus (); + Location end_location = function_body->get_end_locus (); tree code_block = ctx->get_backend ()->block (fndecl, enclosing_scope, locals, @@ -524,7 +524,7 @@ public: tree enclosing_scope = NULL_TREE; HIR::BlockExpr *function_body = func.get_block_expr ().get (); Location start_location = function_body->get_locus (); - Location end_location = function_body->get_closing_locus (); + Location end_location = function_body->get_end_locus (); tree code_block = ctx->get_backend ()->block (fndecl, enclosing_scope, locals, diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index 208a2a5..c35efcc 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -142,7 +142,7 @@ public: HIR::BlockExpr *function_body = static_cast<HIR::BlockExpr *> (constant.get_expr ()); Location start_location = function_body->get_locus (); - Location end_location = function_body->get_closing_locus (); + Location end_location = function_body->get_end_locus (); tree code_block = ctx->get_backend ()->block (fndecl, enclosing_scope, {}, @@ -341,7 +341,7 @@ public: tree enclosing_scope = NULL_TREE; HIR::BlockExpr *function_body = function.get_definition ().get (); Location start_location = function_body->get_locus (); - Location end_location = function_body->get_closing_locus (); + Location end_location = function_body->get_end_locus (); tree code_block = ctx->get_backend ()->block (fndecl, enclosing_scope, locals, diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index 7208ed0..a97ad4d 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -60,7 +60,7 @@ CompileBlock::visit (HIR::BlockExpr &expr) fncontext fnctx = ctx->peek_fn (); tree fndecl = fnctx.fndecl; Location start_location = expr.get_locus (); - Location end_location = expr.get_closing_locus (); + Location end_location = expr.get_end_locus (); auto body_mappings = expr.get_mappings (); Resolver::Rib *rib = nullptr; |