]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Replace Location with location_t in unnamed function parameters
authorOwen Avery <powerboat9.gamer@gmail.com>
Mon, 10 Jul 2023 23:39:02 +0000 (19:39 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:56:02 +0000 (18:56 +0100)
gcc/rust/ChangeLog:

* backend/rust-compile-base.h: Replace Location with location_t.
* metadata/rust-imports.h: Likewise.
* resolve/rust-name-resolver.cc: Likewise.
* resolve/rust-name-resolver.h: Likewise.
* rust-backend.h: Likewise.
* rust-gcc.cc: Likewise.
* rust-gcc.h: Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/backend/rust-compile-base.h
gcc/rust/metadata/rust-imports.h
gcc/rust/resolve/rust-name-resolver.cc
gcc/rust/resolve/rust-name-resolver.h
gcc/rust/rust-backend.h
gcc/rust/rust-gcc.cc
gcc/rust/rust-gcc.h

index d3554466a5273741498163f99f942fd79896ad23..8f64f6c3cceeb00426ae2b407a4eef5fd8a1ed25 100644 (file)
@@ -132,7 +132,7 @@ protected:
 
   static tree indirect_expression (tree expr, location_t locus);
 
-  static bool mark_addressable (tree, Location);
+  static bool mark_addressable (tree, location_t);
 
   static std::vector<Bvariable *>
   compile_locals_for_block (Context *ctx, Resolver::Rib &rib, tree fndecl);
index 6645c77798c0c87a6cdf889a4c3783afeebd1106..71d2ff8262b42ebf96d2041799ddf269c2f767df 100644 (file)
@@ -118,7 +118,7 @@ public:
   try_package_in_directory (const std::string &, Location);
 
   // Constructor.
-  Import (std::unique_ptr<Stream>, Location);
+  Import (std::unique_ptr<Stream>, location_t);
 
   // The location of the import statement.
   location_t location () const { return this->location_; }
@@ -161,16 +161,16 @@ private:
   static int try_suffixes (std::string *);
 
   static std::unique_ptr<Stream> find_export_data (const std::string &filename,
-                                                  int fd, Location);
+                                                  int fd, location_t);
 
   static std::unique_ptr<Stream>
   find_object_export_data (const std::string &filename, int fd, off_t offset,
-                          Location);
+                          location_t);
 
   static bool is_archive_magic (const char *);
 
   static std::unique_ptr<Stream>
-  find_archive_export_data (const std::string &filename, int fd, Location);
+  find_archive_export_data (const std::string &filename, int fd, location_t);
 
   // The stream from which to read import data.
   std::unique_ptr<Stream> stream_;
index da671010f5a979e497ba173779219194c8c0553f..e87ac49be1a07e0cd6858f8bf4a7c6000744e89a 100644 (file)
@@ -30,7 +30,7 @@ void
 Rib::insert_name (
   const CanonicalPath &path, NodeId id, location_t locus, bool shadow,
   ItemType type,
-  std::function<void (const CanonicalPath &, NodeId, Location)> dup_cb)
+  std::function<void (const CanonicalPath &, NodeId, location_t)> dup_cb)
 {
   auto it = path_mappings.find (path);
   bool path_already_exists = it != path_mappings.end ();
@@ -141,7 +141,7 @@ void
 Scope::insert (
   const CanonicalPath &ident, NodeId id, location_t locus, bool shadow,
   Rib::ItemType type,
-  std::function<void (const CanonicalPath &, NodeId, Location)> dup_cb)
+  std::function<void (const CanonicalPath &, NodeId, location_t)> dup_cb)
 {
   peek ()->insert_name (ident, id, locus, shadow, type, dup_cb);
 }
@@ -151,7 +151,7 @@ Scope::insert (const CanonicalPath &ident, NodeId id, location_t locus,
               Rib::ItemType type)
 {
   peek ()->insert_name (ident, id, locus, true, type,
-                       [] (const CanonicalPath &, NodeId, Location) -> void {
+                       [] (const CanonicalPath &, NodeId, location_t) -> void {
                        });
 }
 
@@ -368,7 +368,8 @@ Resolver::insert_builtin_types (Rib *r)
                                  builtin->as_string ());
       r->insert_name (builtin_path, builtin->get_node_id (), BUILTINS_LOCATION,
                      false, Rib::ItemType::Type,
-                     [] (const CanonicalPath &, NodeId, Location) -> void {});
+                     [] (const CanonicalPath &, NodeId, location_t) -> void {
+                     });
     }
 }
 
index 831207fb326ec1c71598d64eded4a989ce01d88f..86a847a66650afe0e592555eb65cd589ca8ced7f 100644 (file)
@@ -57,7 +57,7 @@ public:
   void insert_name (
     const CanonicalPath &path, NodeId id, location_t locus, bool shadow,
     ItemType type,
-    std::function<void (const CanonicalPath &, NodeId, Location)> dup_cb);
+    std::function<void (const CanonicalPath &, NodeId, location_t)> dup_cb);
 
   bool lookup_canonical_path (const NodeId &id, CanonicalPath *ident);
   bool lookup_name (const CanonicalPath &ident, NodeId *id);
@@ -88,10 +88,10 @@ class Scope
 public:
   Scope (CrateNum crate_num);
 
-  void
-  insert (const CanonicalPath &ident, NodeId id, location_t locus, bool shadow,
-         Rib::ItemType type,
-         std::function<void (const CanonicalPath &, NodeId, Location)> dup_cb);
+  void insert (
+    const CanonicalPath &ident, NodeId id, location_t locus, bool shadow,
+    Rib::ItemType type,
+    std::function<void (const CanonicalPath &, NodeId, location_t)> dup_cb);
 
   void insert (const CanonicalPath &ident, NodeId id, location_t locus,
               Rib::ItemType type = Rib::ItemType::Unknown);
index 930768e990330f8ad16acf08f310ff414e5083d1..f5048f0611d111bb022de5cffdbc49ada194fa9d 100644 (file)
@@ -145,7 +145,7 @@ public:
   // created via placeholder_pointer_type, placeholder_struct_type, or
   // placeholder_array_type..  (It may be called for a pointer,
   // struct, or array type in a case like "type P *byte; type Q P".)
-  virtual tree named_type (const std::string &name, tree, Location) = 0;
+  virtual tree named_type (const std::string &name, tree, location_t) = 0;
 
   // Return the size of a type.
   virtual int64_t type_size (tree) = 0;
@@ -170,7 +170,7 @@ public:
   virtual tree zero_expression (tree) = 0;
 
   // Create a reference to a variable.
-  virtual tree var_expression (Bvariable *var, Location) = 0;
+  virtual tree var_expression (Bvariable *var, location_t) = 0;
 
   // Return an expression for the multi-precision integer VAL in BTYPE.
   virtual tree integer_constant_expression (tree btype, mpz_t val) = 0;
@@ -194,35 +194,35 @@ public:
   virtual tree boolean_constant_expression (bool val) = 0;
 
   // Return an expression for the real part of BCOMPLEX.
-  virtual tree real_part_expression (tree bcomplex, Location) = 0;
+  virtual tree real_part_expression (tree bcomplex, location_t) = 0;
 
   // Return an expression for the imaginary part of BCOMPLEX.
-  virtual tree imag_part_expression (tree bcomplex, Location) = 0;
+  virtual tree imag_part_expression (tree bcomplex, location_t) = 0;
 
   // Return an expression for the complex number (BREAL, BIMAG).
-  virtual tree complex_expression (tree breal, tree bimag, Location) = 0;
+  virtual tree complex_expression (tree breal, tree bimag, location_t) = 0;
 
   // Return an expression that converts EXPR to TYPE.
-  virtual tree convert_expression (tree type, tree expr, Location) = 0;
+  virtual tree convert_expression (tree type, tree expr, location_t) = 0;
 
   // Return an expression for the field at INDEX in BSTRUCT.
-  virtual tree struct_field_expression (tree bstruct, size_t index, Location)
+  virtual tree struct_field_expression (tree bstruct, size_t index, location_t)
     = 0;
 
   // Create an expression that executes BSTAT before BEXPR.
-  virtual tree compound_expression (tree bstat, tree bexpr, Location) = 0;
+  virtual tree compound_expression (tree bstat, tree bexpr, location_t) = 0;
 
   // Return an expression that executes THEN_EXPR if CONDITION is true, or
   // ELSE_EXPR otherwise and returns the result as type BTYPE, within the
   // specified function FUNCTION.  ELSE_EXPR may be NULL.  BTYPE may be NULL.
   virtual tree conditional_expression (tree function, tree btype,
                                       tree condition, tree then_expr,
-                                      tree else_expr, Location)
+                                      tree else_expr, location_t)
     = 0;
 
   // Return an expression for the negation operation OP EXPR.
   // Supported values of OP are enumerated in NegationOperator.
-  virtual tree negation_expression (NegationOperator op, tree expr, Location)
+  virtual tree negation_expression (NegationOperator op, tree expr, location_t)
     = 0;
 
   // Return an expression for the operation LEFT OP RIGHT.
@@ -252,7 +252,7 @@ public:
   // Return an expression for the operation LEFT OP RIGHT.
   // Supported values of OP are enumerated in LazyBooleanOperator.
   virtual tree lazy_boolean_expression (LazyBooleanOperator op, tree left,
-                                       tree right, Location)
+                                       tree right, location_t)
     = 0;
 
   // Return an expression that constructs BTYPE with VALS.  BTYPE must be the
@@ -260,7 +260,7 @@ public:
   // corresponding fields in BTYPE.
   virtual tree constructor_expression (tree btype, bool is_variant,
                                       const std::vector<tree> &vals, int,
-                                      Location)
+                                      location_t)
     = 0;
 
   // Return an expression that constructs an array of BTYPE with INDEXES and
@@ -269,21 +269,21 @@ public:
   virtual tree
   array_constructor_expression (tree btype,
                                const std::vector<unsigned long> &indexes,
-                               const std::vector<tree> &vals, Location)
+                               const std::vector<tree> &vals, location_t)
     = 0;
 
   virtual tree array_initializer (tree, tree, tree, tree, tree, tree *,
-                                 Location)
+                                 location_t)
     = 0;
 
   // Return an expression for ARRAY[INDEX] as an l-value.  ARRAY is a valid
   // fixed-length array, not a slice.
-  virtual tree array_index_expression (tree array, tree index, Location) = 0;
+  virtual tree array_index_expression (tree array, tree index, location_t) = 0;
 
   // Create an expression for a call to FN with ARGS, taking place within
   // caller CALLER.
   virtual tree call_expression (tree fn, const std::vector<tree> &args,
-                               tree static_chain, Location)
+                               tree static_chain, location_t)
     = 0;
 
   // Statements.
@@ -294,22 +294,22 @@ public:
   virtual tree init_statement (tree, Bvariable *var, tree init) = 0;
 
   // Create an assignment statement within the specified function.
-  virtual tree assignment_statement (tree lhs, tree rhs, Location) = 0;
+  virtual tree assignment_statement (tree lhs, tree rhs, location_t) = 0;
 
   // Create return statement for an decl for a value (can be NULL_TREE) at a
   // location
-  virtual tree return_statement (tree fndecl, tree val, Location) = 0;
+  virtual tree return_statement (tree fndecl, tree val, location_t) = 0;
 
   // Create an if statement within a function.  ELSE_BLOCK may be NULL.
   virtual tree if_statement (tree, tree condition, tree then_block,
-                            tree else_block, Location)
+                            tree else_block, location_t)
     = 0;
 
   // infinite loop expressions
-  virtual tree loop_expression (tree body, Location) = 0;
+  virtual tree loop_expression (tree body, location_t) = 0;
 
   // exit expressions
-  virtual tree exit_expression (tree condition, Location) = 0;
+  virtual tree exit_expression (tree condition, location_t) = 0;
 
   // Create a single statement from two statements.
   virtual tree compound_statement (tree, tree) = 0;
@@ -323,7 +323,7 @@ public:
   // in Go functions.  In C++, the resulting code is of this form:
   //   try { BSTAT; } catch { EXCEPT_STMT; } finally { FINALLY_STMT; }
   virtual tree exception_handler_statement (tree bstat, tree except_stmt,
-                                           tree finally_stmt, Location)
+                                           tree finally_stmt, location_t)
     = 0;
 
   // Blocks.
@@ -431,7 +431,7 @@ public:
   // Create a new label.  NAME will be empty if this is a label
   // created by the frontend for a loop construct.  The location is
   // where the label is defined.
-  virtual tree label (tree, const std::string &name, Location) = 0;
+  virtual tree label (tree, const std::string &name, location_t) = 0;
 
   // Create a statement which defines a label.  This statement will be
   // put into the codestream at the point where the label should be
@@ -439,12 +439,12 @@ public:
   virtual tree label_definition_statement (tree) = 0;
 
   // Create a goto statement to a label.
-  virtual tree goto_statement (tree, Location) = 0;
+  virtual tree goto_statement (tree, location_t) = 0;
 
   // Create an expression for the address of a label.  This is used to
   // get the return address of a deferred function which may call
   // recover.
-  virtual tree label_address (tree, Location) = 0;
+  virtual tree label_address (tree, location_t) = 0;
 
   // Functions.
 
@@ -473,7 +473,7 @@ public:
   // bit flags described above.
   virtual tree function (tree fntype, const std::string &name,
                         const std::string &asm_name, unsigned int flags,
-                        Location)
+                        location_t)
     = 0;
 
   // Create a statement that runs all deferred calls for FUNCTION.  This should
@@ -481,7 +481,7 @@ public:
   //   finish:
   //     try { DEFER_RETURN; } catch { CHECK_DEFER; goto finish; }
   virtual tree function_defer_statement (tree function, tree undefer,
-                                        tree check_defer, Location)
+                                        tree check_defer, location_t)
     = 0;
 
   // Record PARAM_VARS as the variables to use for the parameters of FUNCTION.
index ab9cf4921ddd50a804320827b993a49f55f4ae04..119b02d44b206c0b7593fb454f10a3e13f2b6863 100644 (file)
@@ -120,14 +120,14 @@ public:
   tree function_type (const typed_identifier &,
                      const std::vector<typed_identifier> &,
                      const std::vector<typed_identifier> &, tree,
-                     const Location);
+                     const location_t);
 
   tree function_type_varadic (const typed_identifier &,
                              const std::vector<typed_identifier> &,
                              const std::vector<typed_identifier> &, tree,
-                             const Location);
+                             const location_t);
 
-  tree function_ptr_type (tree, const std::vector<tree> &, Location);
+  tree function_ptr_type (tree, const std::vector<tree> &, location_t);
 
   tree struct_type (const std::vector<typed_identifier> &);
 
@@ -135,7 +135,7 @@ public:
 
   tree array_type (tree, tree);
 
-  tree named_type (const std::string &, tree, Location);
+  tree named_type (const std::string &, tree, location_t);
 
   int64_t type_size (tree);
 
@@ -149,7 +149,7 @@ public:
 
   tree zero_expression (tree);
 
-  tree var_expression (Bvariable *var, Location);
+  tree var_expression (Bvariable *var, location_t);
 
   tree integer_constant_expression (tree type, mpz_t val);
 
@@ -165,73 +165,74 @@ public:
 
   tree boolean_constant_expression (bool val);
 
-  tree real_part_expression (tree bcomplex, Location);
+  tree real_part_expression (tree bcomplex, location_t);
 
-  tree imag_part_expression (tree bcomplex, Location);
+  tree imag_part_expression (tree bcomplex, location_t);
 
-  tree complex_expression (tree breal, tree bimag, Location);
+  tree complex_expression (tree breal, tree bimag, location_t);
 
-  tree convert_expression (tree type, tree expr, Location);
+  tree convert_expression (tree type, tree expr, location_t);
 
-  tree struct_field_expression (tree, size_t, Location);
+  tree struct_field_expression (tree, size_t, location_t);
 
-  tree compound_expression (tree, tree, Location);
+  tree compound_expression (tree, tree, location_t);
 
-  tree conditional_expression (tree, tree, tree, tree, tree, Location);
+  tree conditional_expression (tree, tree, tree, tree, tree, location_t);
 
-  tree negation_expression (NegationOperator op, tree expr, Location);
+  tree negation_expression (NegationOperator op, tree expr, location_t);
 
   tree arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op,
-                                        tree left, tree right, Location);
+                                        tree left, tree right, location_t);
 
   tree arithmetic_or_logical_expression_checked (ArithmeticOrLogicalOperator op,
                                                 tree left, tree right,
                                                 Location, Bvariable *receiver);
 
   tree comparison_expression (ComparisonOperator op, tree left, tree right,
-                             Location);
+                             location_t);
 
   tree lazy_boolean_expression (LazyBooleanOperator op, tree left, tree right,
-                               Location);
+                               location_t);
 
   tree constructor_expression (tree, bool, const std::vector<tree> &, int,
-                              Location);
+                              location_t);
 
   tree array_constructor_expression (tree, const std::vector<unsigned long> &,
-                                    const std::vector<tree> &, Location);
+                                    const std::vector<tree> &, location_t);
 
-  tree array_initializer (tree, tree, tree, tree, tree, tree *, Location);
+  tree array_initializer (tree, tree, tree, tree, tree, tree *, location_t);
 
-  tree array_index_expression (tree array, tree index, Location);
+  tree array_index_expression (tree array, tree index, location_t);
 
   tree call_expression (tree fn, const std::vector<tree> &args,
-                       tree static_chain, Location);
+                       tree static_chain, location_t);
 
   // Statements.
 
   tree init_statement (tree, Bvariable *var, tree init);
 
-  tree assignment_statement (tree lhs, tree rhs, Location);
+  tree assignment_statement (tree lhs, tree rhs, location_t);
 
   tree return_statement (tree fndecl, tree val, location_t locus);
 
   tree if_statement (tree, tree condition, tree then_block, tree else_block,
-                    Location);
+                    location_t);
 
   tree compound_statement (tree, tree);
 
   tree statement_list (const std::vector<tree> &);
 
   tree exception_handler_statement (tree bstat, tree except_stmt,
-                                   tree finally_stmt, Location);
+                                   tree finally_stmt, location_t);
 
-  tree loop_expression (tree body, Location);
+  tree loop_expression (tree body, location_t);
 
-  tree exit_expression (tree condition, Location);
+  tree exit_expression (tree condition, location_t);
 
   // Blocks.
 
-  tree block (tree, tree, const std::vector<Bvariable *> &, Location, Location);
+  tree block (tree, tree, const std::vector<Bvariable *> &, Location,
+             location_t);
 
   void block_add_statements (tree, const std::vector<tree> &);
 
@@ -247,32 +248,33 @@ public:
   void global_variable_set_init (Bvariable *, tree);
 
   Bvariable *local_variable (tree, const std::string &, tree, Bvariable *,
-                            Location);
+                            location_t);
 
-  Bvariable *parameter_variable (tree, const std::string &, tree, Location);
+  Bvariable *parameter_variable (tree, const std::string &, tree, location_t);
 
-  Bvariable *static_chain_variable (tree, const std::string &, tree, Location);
+  Bvariable *static_chain_variable (tree, const std::string &, tree,
+                                   location_t);
 
   Bvariable *temporary_variable (tree, tree, tree, tree, bool, Location,
                                 tree *);
 
   // Labels.
 
-  tree label (tree, const std::string &name, Location);
+  tree label (tree, const std::string &name, location_t);
 
   tree label_definition_statement (tree);
 
-  tree goto_statement (tree, Location);
+  tree goto_statement (tree, location_t);
 
-  tree label_address (tree, Location);
+  tree label_address (tree, location_t);
 
   // Functions.
 
   tree function (tree fntype, const std::string &name,
-                const std::string &asm_name, unsigned int flags, Location);
+                const std::string &asm_name, unsigned int flags, location_t);
 
   tree function_defer_statement (tree function, tree undefer, tree defer,
-                                Location);
+                                location_t);
 
   bool function_set_parameters (tree function,
                                const std::vector<Bvariable *> &);
@@ -291,7 +293,7 @@ private:
 
   tree non_zero_size_type (tree);
 
-  tree convert_tree (tree, tree, Location);
+  tree convert_tree (tree, tree, location_t);
 };
 
 // A helper function to create a GCC identifier from a C++ string.
@@ -683,7 +685,7 @@ tree
 Gcc_backend::function_type (const typed_identifier &receiver,
                            const std::vector<typed_identifier> &parameters,
                            const std::vector<typed_identifier> &results,
-                           tree result_struct, Location)
+                           tree result_struct, location_t)
 {
   tree args = NULL_TREE;
   tree *pp = &args;
@@ -734,7 +736,7 @@ tree
 Gcc_backend::function_type_varadic (
   const typed_identifier &receiver,
   const std::vector<typed_identifier> &parameters,
-  const std::vector<typed_identifier> &results, tree result_struct, Location)
+  const std::vector<typed_identifier> &results, tree result_struct, location_t)
 {
   size_t n = parameters.size () + (receiver.type != NULL_TREE ? 1 : 0);
   tree *args = XALLOCAVEC (tree, n);
@@ -2082,7 +2084,7 @@ Gcc_backend::statement_list (const std::vector<tree> &statements)
 tree
 Gcc_backend::block (tree fndecl, tree enclosing,
                    const std::vector<Bvariable *> &vars,
-                   Location start_location, Location)
+                   Location start_location, location_t)
 {
   tree block_tree = make_node (BLOCK);
   if (enclosing == NULL)
index 79494f74cde15966457824a580493e3184b0acec..1a5c1fa33f010522b18504da97e50f4230d45c1a 100644 (file)
@@ -44,7 +44,7 @@ public:
   Bvariable (tree t, tree orig_type) : t_ (t), orig_type_ (orig_type) {}
 
   // Get the tree for use as an expression.
-  tree get_tree (Location) const;
+  tree get_tree (location_t) const;
 
   // Get the actual decl;
   tree get_decl () const { return this->t_; }