]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Remove unnecessary usage of Location copy constructor
authorOwen Avery <powerboat9.gamer@gmail.com>
Mon, 10 Jul 2023 18:43:18 +0000 (14:43 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:49:36 +0000 (18:49 +0100)
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>
gcc/rust/ast/rust-expr.h
gcc/rust/backend/rust-constexpr.cc
gcc/rust/util/rust-token-converter.cc

index dd589e77db5cfed6bd8ef13c0d5470778dcd8618..1ea82c7d7242413487b7c326d2e4a5badae77cbf 100644 (file)
@@ -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;
 
index df5c2e427d1e2538da5807c45ec9befa782e1a15..0eed9186905814969f7ac7aecc26b3741e101121 100644 (file)
@@ -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));
index 1ba80a1647a79d7d99eb9a4a0ab3eb6d12a7d88a..adc4626f6a0d0dc577bc0f4b08c7e0af75f24f87 100644 (file)
@@ -60,7 +60,7 @@ convert (Location location)
 static Location
 convert (ProcMacro::Span span)
 {
-  return Location (span.start);
+  return span.start;
 }
 
 static void