diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-07-10 14:43:18 -0400 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:49:36 +0100 |
commit | 805cb985847ab6fec91081ee625240e2d9129a1c (patch) | |
tree | 5eed9553d91bd3c6c2d729f3e18513b1c7401efb | |
parent | e659eca9f3b9c167c37a7862cb45d996fb784a6f (diff) | |
download | gcc-805cb985847ab6fec91081ee625240e2d9129a1c.zip gcc-805cb985847ab6fec91081ee625240e2d9129a1c.tar.gz gcc-805cb985847ab6fec91081ee625240e2d9129a1c.tar.bz2 |
gccrs: Remove unnecessary usage of Location copy constructor
gcc/rust/ChangeLog:
* ast/rust-expr.h
(MetaItemPathLit::get_locus): Remove copy construction.
* backend/rust-constexpr.cc
(eval_constant_expression): Likewise.
(is_valid_constexpr_fn): Likewise.
* util/rust-token-converter.cc
(convert): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
-rw-r--r-- | gcc/rust/ast/rust-expr.h | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-constexpr.cc | 4 | ||||
-rw-r--r-- | gcc/rust/util/rust-token-converter.cc | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index dd589e7..1ea82c7 100644 --- a/gcc/rust/ast/rust-expr.h +++ b/gcc/rust/ast/rust-expr.h @@ -232,7 +232,7 @@ public: // we have no idea use which of them, just simply return UNKNOWN_LOCATION // now. // Maybe we will figure out when we really need the location in the future. - Location get_locus () const override { return Location (UNKNOWN_LOCATION); } + Location get_locus () const override { return UNKNOWN_LOCATION; } void accept_vis (ASTVisitor &vis) override; diff --git a/gcc/rust/backend/rust-constexpr.cc b/gcc/rust/backend/rust-constexpr.cc index df5c2e4..0eed918 100644 --- a/gcc/rust/backend/rust-constexpr.cc +++ b/gcc/rust/backend/rust-constexpr.cc @@ -1912,7 +1912,7 @@ eval_constant_expression (const constexpr_ctx *ctx, tree t, bool lval, if (++ctx->global->constexpr_ops_count >= constexpr_ops_limit) { rust_error_at ( - Location (loc), + loc, "%<constexpr%> evaluation operation count exceeds limit of " "%wd (use %<-fconstexpr-ops-limit=%> to increase the limit)", constexpr_ops_limit); @@ -4522,7 +4522,7 @@ is_valid_constexpr_fn (tree fun, bool complain) // error ("invalid type for parameter %d of %<constexpr%> " // "function %q+#D", // DECL_PARM_INDEX (parm), fun); - Location locus = Location (DECL_SOURCE_LOCATION (fun)); + Location locus = DECL_SOURCE_LOCATION (fun); rust_error_at ( locus, "invalid type for parameter %d of %<constexpr%> function", DECL_PARM_INDEX (parm)); diff --git a/gcc/rust/util/rust-token-converter.cc b/gcc/rust/util/rust-token-converter.cc index 1ba80a1..adc4626 100644 --- a/gcc/rust/util/rust-token-converter.cc +++ b/gcc/rust/util/rust-token-converter.cc @@ -60,7 +60,7 @@ convert (Location location) static Location convert (ProcMacro::Span span) { - return Location (span.start); + return span.start; } static void |