diff options
author | David Faust <david.faust@oracle.com> | 2021-11-15 10:27:34 -0800 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2021-11-16 13:15:56 -0800 |
commit | 5c87e61f96e0b394ce406bf9967c92708a16becc (patch) | |
tree | 7bd431f6cd496e67e3ac8947f975a636093a1485 /gcc/rust/backend/rust-compile-context.h | |
parent | 01a52df9440a78ec5221c7f2430f06e770133e06 (diff) | |
download | gcc-5c87e61f96e0b394ce406bf9967c92708a16becc.zip gcc-5c87e61f96e0b394ce406bf9967c92708a16becc.tar.gz gcc-5c87e61f96e0b394ce406bf9967c92708a16becc.tar.bz2 |
clang-format and minor cleanup
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index 72ab4f2..668e8ba 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -35,7 +35,7 @@ namespace Compile { struct fncontext { - ::tree fndecl; + tree fndecl; ::Bvariable *ret_addr; }; @@ -61,19 +61,19 @@ public: rust_assert (ok); tree compiled = TyTyCompile::compile (backend, lookup); - compiled_type_map.insert (std::pair<HirId, tree > (ref, compiled)); + compiled_type_map.insert (std::pair<HirId, tree> (ref, compiled)); builtin_range.insert (ref); } } - bool lookup_compiled_types (HirId id, ::tree *type, + bool lookup_compiled_types (HirId id, tree *type, const TyTy::BaseType *ref = nullptr) { if (ref != nullptr) { for (auto it = mono.begin (); it != mono.end (); it++) { - std::pair<HirId, ::tree > &val = it->second; + std::pair<HirId, tree> &val = it->second; const TyTy::BaseType *r = it->first; if (ref->is_equal (*r)) @@ -94,14 +94,14 @@ public: return true; } - void insert_compiled_type (HirId id, ::tree type, + void insert_compiled_type (HirId id, tree type, const TyTy::BaseType *ref = nullptr) { rust_assert (builtin_range.find (id) == builtin_range.end ()); - compiled_type_map.insert (std::pair<HirId, tree > (id, type)); + compiled_type_map.insert (std::pair<HirId, tree> (id, type)); if (ref != nullptr) { - std::pair<HirId, ::tree > elem (id, type); + std::pair<HirId, tree> elem (id, type); mono[ref] = std::move (elem); } } @@ -209,9 +209,9 @@ public: return true; } - void insert_const_decl (HirId id, ::tree expr) { compiled_consts[id] = expr; } + void insert_const_decl (HirId id, tree expr) { compiled_consts[id] = expr; } - bool lookup_const_decl (HirId id, ::tree *expr) + bool lookup_const_decl (HirId id, tree *expr) { auto it = compiled_consts.find (id); if (it == compiled_consts.end ()) @@ -240,9 +240,9 @@ public: void pop_fn () { fn_stack.pop_back (); } fncontext peek_fn () { return fn_stack.back (); } - void push_type (::tree t) { type_decls.push_back (t); } + void push_type (tree t) { type_decls.push_back (t); } void push_var (::Bvariable *v) { var_decls.push_back (v); } - void push_const (::tree c) { const_decls.push_back (c); } + void push_const (tree c) { const_decls.push_back (c); } void push_function (tree f) { func_decls.push_back (f); } void write_to_backend () @@ -323,7 +323,7 @@ private: std::vector<tree> scope_stack; std::vector<::Bvariable *> loop_value_stack; std::vector<tree> loop_begin_labels; - std::map<const TyTy::BaseType *, std::pair<HirId, ::tree >> mono; + std::map<const TyTy::BaseType *, std::pair<HirId, tree>> mono; std::map<DefId, std::vector<std::pair<const TyTy::BaseType *, tree>>> mono_fns; @@ -338,7 +338,7 @@ class TyTyResolveCompile : public TyTy::TyConstVisitor { public: static tree compile (Context *ctx, const TyTy::BaseType *ty, - bool trait_object_mode = false) + bool trait_object_mode = false) { TyTyResolveCompile compiler (ctx, trait_object_mode); ty->accept_vis (compiler); @@ -410,7 +410,7 @@ public: tree result_type = TyTyResolveCompile::compile (ctx, type.get_return_type ()); - std::vector<tree > parameters; + std::vector<tree> parameters; type.iterate_params ([&] (TyTy::BaseType *p) mutable -> bool { tree pty = TyTyResolveCompile::compile (ctx, p); parameters.push_back (pty); @@ -440,8 +440,8 @@ public: = TyTyResolveCompile::compile (ctx, field->get_field_type ()); Backend::typed_identifier f (field->get_name (), compiled_field_ty, - ctx->get_mappings ()->lookup_location ( - type.get_ty_ref ())); + ctx->get_mappings ()->lookup_location ( + type.get_ty_ref ())); fields.push_back (std::move (f)); } @@ -488,9 +488,9 @@ public: // approach makes it simpler to use a C-only debugger, or // GDB's C mode, when debugging Rust. Backend::typed_identifier f ("__" + std::to_string (i), - compiled_field_ty, - ctx->get_mappings ()->lookup_location ( - type.get_ty_ref ())); + compiled_field_ty, + ctx->get_mappings ()->lookup_location ( + type.get_ty_ref ())); fields.push_back (std::move (f)); } @@ -515,7 +515,7 @@ public: void visit (const TyTy::BoolType &type) override { - ::tree compiled_type = nullptr; + tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -523,7 +523,7 @@ public: void visit (const TyTy::IntType &type) override { - ::tree compiled_type = nullptr; + tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -531,7 +531,7 @@ public: void visit (const TyTy::UintType &type) override { - ::tree compiled_type = nullptr; + tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -539,7 +539,7 @@ public: void visit (const TyTy::FloatType &type) override { - ::tree compiled_type = nullptr; + tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -547,7 +547,7 @@ public: void visit (const TyTy::USizeType &type) override { - ::tree compiled_type = nullptr; + tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -555,7 +555,7 @@ public: void visit (const TyTy::ISizeType &type) override { - ::tree compiled_type = nullptr; + tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -563,7 +563,7 @@ public: void visit (const TyTy::CharType &type) override { - ::tree compiled_type = nullptr; + tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -601,7 +601,7 @@ public: void visit (const TyTy::StrType &type) override { - ::tree compiled_type = nullptr; + tree compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); rust_assert (ok); translated = compiled_type; @@ -633,8 +633,8 @@ public: tree uintptr_ty = ctx->get_backend ()->pointer_type (uint); Backend::typed_identifier f ("__receiver_trait_obj_ptr", uintptr_ty, - ctx->get_mappings ()->lookup_location ( - type.get_ty_ref ())); + ctx->get_mappings ()->lookup_location ( + type.get_ty_ref ())); fields.push_back (std::move (f)); for (size_t i = 0; i < items.size (); i++) @@ -645,8 +645,8 @@ public: tree uintptr_ty = ctx->get_backend ()->pointer_type (uint); Backend::typed_identifier f ("__" + std::to_string (i), uintptr_ty, - ctx->get_mappings ()->lookup_location ( - type.get_ty_ref ())); + ctx->get_mappings ()->lookup_location ( + type.get_ty_ref ())); fields.push_back (std::move (f)); } @@ -672,7 +672,7 @@ private: Context *ctx; bool trait_object_mode; - ::tree translated; + tree translated; size_t recursion_count; static const size_t kDefaultRecusionLimit = 5; |