diff options
author | YizhePKU <42838469+YizhePKU@users.noreply.github.com> | 2021-04-09 10:37:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 10:37:53 +0800 |
commit | 5c14e5f9c7262336bf11dfede6277dd727b83010 (patch) | |
tree | f4d40a9c91e92aaaa3450166cf6ee7cdb38e055a /gcc/rust | |
parent | 5da07eb33b5453c932ab1248629d9feebf0da6b1 (diff) | |
parent | 4937562f7ca354dc80369cc2e049c391838537f1 (diff) | |
download | gcc-5c14e5f9c7262336bf11dfede6277dd727b83010.zip gcc-5c14e5f9c7262336bf11dfede6277dd727b83010.tar.gz gcc-5c14e5f9c7262336bf11dfede6277dd727b83010.tar.bz2 |
Merge branch 'master' into fix-zero-length-array-2
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/ast/rust-item.h | 2 | ||||
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 4 | ||||
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-expr.h | 2 | ||||
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-item.h | 33 | ||||
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-type.h | 2 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-item.h | 25 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-path.h | 6 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-type.h | 7 | ||||
-rw-r--r-- | gcc/rust/lex/rust-lex.cc | 3 | ||||
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 16 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-item.h | 16 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-toplevel.h | 10 | ||||
-rw-r--r-- | gcc/rust/rust-diagnostics.cc | 3 | ||||
-rw-r--r-- | gcc/rust/rust-session-manager.cc | 15 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-expr.h | 6 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-implitem.h | 3 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-toplevel.h | 8 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check.cc | 30 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.cc | 12 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.h | 78 |
20 files changed, 224 insertions, 57 deletions
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h index 773bcaf..8ffe150 100644 --- a/gcc/rust/ast/rust-item.h +++ b/gcc/rust/ast/rust-item.h @@ -1720,6 +1720,8 @@ public: return existing_type; } + Identifier get_new_type_name () const { return new_type_name; } + protected: /* Use covariance to implement clone function as returning this object * rather than base */ diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index b60f9b2..e52cb7b 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -3182,6 +3182,7 @@ MacroExpander::expand_cfg_macro (AST::MacroInvocData &invoc) return AST::Literal ("false", AST::Literal::BOOL, CORETYPE_BOOL); } +#if 0 AST::ASTFragment MacroExpander::expand_decl_macro (AST::MacroInvocData &invoc, AST::MacroRulesDefinition &rules_def) @@ -3225,6 +3226,7 @@ MacroExpander::expand_decl_macro (AST::MacroInvocData &invoc, * all the time, while still allowing the heterogenous storage of token trees. */ } +#endif void MacroExpander::expand_invoc (std::unique_ptr<AST::MacroInvocation> &invoc) @@ -3329,7 +3331,7 @@ MacroExpander::fails_cfg_with_expand (std::vector<AST::Attribute> &attrs) const void MacroExpander::expand_cfg_attrs (std::vector<AST::Attribute> &attrs) { - for (std::size_t i = 0; i < attrs.size ();) + for (std::size_t i = 0; i < attrs.size (); i++) { auto &attr = attrs[i]; if (attr.get_path () == "cfg_attr") diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h index 1922a3b..c59412f 100644 --- a/gcc/rust/hir/rust-ast-lower-expr.h +++ b/gcc/rust/hir/rust-ast-lower-expr.h @@ -501,6 +501,8 @@ public: case CompoundAssignmentOperator::RIGHT_SHIFT: op = ArithmeticOrLogicalOperator::RIGHT_SHIFT; break; + default: + gcc_unreachable (); } HIR::Expr *asignee_expr diff --git a/gcc/rust/hir/rust-ast-lower-item.h b/gcc/rust/hir/rust-ast-lower-item.h index 7f6594d..edbc498 100644 --- a/gcc/rust/hir/rust-ast-lower-item.h +++ b/gcc/rust/hir/rust-ast-lower-item.h @@ -53,6 +53,39 @@ public: return resolver.translated; } + void visit (AST::TypeAlias &alias) override + { + std::vector<std::unique_ptr<HIR::WhereClauseItem> > where_clause_items; + HIR::WhereClause where_clause (std::move (where_clause_items)); + HIR::Visibility vis = HIR::Visibility::create_public (); + std::vector<HIR::Attribute> outer_attrs; + + std::vector<std::unique_ptr<HIR::GenericParam> > generic_params; + if (alias.has_generics ()) + generic_params = lower_generic_params (alias.get_generic_params ()); + + HIR::Type *existing_type + = ASTLoweringType::translate (alias.get_type_aliased ().get ()); + + auto crate_num = mappings->get_current_crate (); + Analysis::NodeMapping mapping (crate_num, alias.get_node_id (), + mappings->get_next_hir_id (crate_num), + mappings->get_next_localdef_id (crate_num)); + + translated = new HIR::TypeAlias (mapping, alias.get_new_type_name (), + std::move (generic_params), + std::move (where_clause), + std::unique_ptr<HIR::Type> (existing_type), + std::move (vis), std::move (outer_attrs), + alias.get_locus ()); + + mappings->insert_defid_mapping (mapping.get_defid (), translated); + mappings->insert_hir_item (mapping.get_crate_num (), mapping.get_hirid (), + translated); + mappings->insert_location (crate_num, mapping.get_hirid (), + alias.get_locus ()); + } + void visit (AST::TupleStruct &struct_decl) override { std::vector<std::unique_ptr<HIR::GenericParam> > generic_params; diff --git a/gcc/rust/hir/rust-ast-lower-type.h b/gcc/rust/hir/rust-ast-lower-type.h index cd9b032..318d126 100644 --- a/gcc/rust/hir/rust-ast-lower-type.h +++ b/gcc/rust/hir/rust-ast-lower-type.h @@ -67,6 +67,8 @@ public: case AST::MaybeNamedParam::ParamKind::WILDCARD: kind = HIR::MaybeNamedParam::ParamKind::WILDCARD; break; + default: + gcc_unreachable (); } HIR::Type *param_type diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index c9723f8..a117333 100644 --- a/gcc/rust/hir/tree/rust-hir-item.h +++ b/gcc/rust/hir/tree/rust-hir-item.h @@ -1504,6 +1504,31 @@ public: void accept_vis (HIRVisitor &vis) override; + std::vector<std::unique_ptr<GenericParam> > &get_generic_params () + { + return generic_params; + } + const std::vector<std::unique_ptr<GenericParam> > &get_generic_params () const + { + return generic_params; + } + + // TODO: is this better? Or is a "vis_block" better? + WhereClause &get_where_clause () + { + rust_assert (has_where_clause ()); + return where_clause; + } + + // TODO: is this better? Or is a "vis_block" better? + std::unique_ptr<Type> &get_type_aliased () + { + rust_assert (existing_type != nullptr); + return existing_type; + } + + Identifier get_new_type_name () const { return new_type_name; } + protected: /* Use covariance to implement clone function as returning this object * rather than base */ diff --git a/gcc/rust/hir/tree/rust-hir-path.h b/gcc/rust/hir/tree/rust-hir-path.h index 2affb68..8dbde9c 100644 --- a/gcc/rust/hir/tree/rust-hir-path.h +++ b/gcc/rust/hir/tree/rust-hir-path.h @@ -817,11 +817,15 @@ public: // Copy constructor with vector clone QualifiedPathInType (QualifiedPathInType const &other) - : TypeNoBounds (mappings), path_type (other.path_type), locus (other.locus) + : TypeNoBounds (other.mappings), path_type (other.path_type), + locus (other.locus) { segments.reserve (other.segments.size ()); for (const auto &e : other.segments) segments.push_back (e->clone_type_path_segment ()); + + // Untested. + gcc_unreachable (); } // Overloaded assignment operator with vector clone diff --git a/gcc/rust/hir/tree/rust-hir-type.h b/gcc/rust/hir/tree/rust-hir-type.h index 47850ae..42fccb5 100644 --- a/gcc/rust/hir/tree/rust-hir-type.h +++ b/gcc/rust/hir/tree/rust-hir-type.h @@ -604,9 +604,12 @@ public: // Copy constructor requires deep copies of both unique pointers ArrayType (ArrayType const &other) - : TypeNoBounds (mappings), elem_type (other.elem_type->clone_type ()), + : TypeNoBounds (other.mappings), elem_type (other.elem_type->clone_type ()), size (other.size->clone_expr ()), locus (other.locus) - {} + { + // Untested. + gcc_unreachable (); + } // Overload assignment operator to deep copy pointers ArrayType &operator= (ArrayType const &other) diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc index 26745e4..f95a47d 100644 --- a/gcc/rust/lex/rust-lex.cc +++ b/gcc/rust/lex/rust-lex.cc @@ -430,8 +430,7 @@ Lexer::build_token () if (current_char == EOF) { rust_error_at ( - loc, "unexpected EOF while looking for end of comment", - current_char); + loc, "unexpected EOF while looking for end of comment"); break; } diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index cb20a2e..c14863a 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -729,7 +729,7 @@ Parser<ManagedTokenSource>::parse_attr_input () case LEFT_SQUARE: case LEFT_CURLY: { // must be a delimited token tree, so parse that - std::unique_ptr<AST::DelimTokenTree> input_tree ( + std::unique_ptr<AST::AttrInput> input_tree ( new AST::DelimTokenTree (parse_delim_token_tree ())); // TODO: potential checks on DelimTokenTree before returning @@ -785,7 +785,7 @@ Parser<ManagedTokenSource>::parse_attr_input () AST::LiteralExpr lit_expr (t->get_str (), lit_type, t->get_type_hint (), {}, t->get_locus ()); - std::unique_ptr<AST::AttrInputLiteral> attr_input_lit ( + std::unique_ptr<AST::AttrInput> attr_input_lit ( new AST::AttrInputLiteral (std::move (lit_expr))); // do checks or whatever? none required, really @@ -4866,7 +4866,7 @@ Parser<ManagedTokenSource>::parse_trait_item () } default: { // TODO: try and parse macro invocation semi - if fails, maybe error. - std::unique_ptr<AST::MacroInvocationSemi> macro_invoc + std::unique_ptr<AST::TraitItem> macro_invoc = parse_macro_invocation_semi (outer_attrs); if (macro_invoc == nullptr) @@ -4896,13 +4896,11 @@ Parser<ManagedTokenSource>::parse_trait_type ( const_TokenPtr ident_tok = expect_token (IDENTIFIER); Identifier ident = ident_tok->get_str (); - bool has_colon = false; - std::vector<std::unique_ptr<AST::TypeParamBound>> bounds; + std::vector<std::unique_ptr<AST::TypeParamBound> > bounds; // parse optional colon if (lexer.peek_token ()->get_id () == COLON) { - has_colon = true; lexer.skip_token (); // parse optional type param bounds @@ -8575,12 +8573,8 @@ std::vector<std::unique_ptr<AST::Pattern>> Parser<ManagedTokenSource>::parse_match_arm_patterns (TokenId end_token_id) { // skip optional leading '|' - bool has_leading_pipe = false; if (lexer.peek_token ()->get_id () == PIPE) - { - has_leading_pipe = true; - lexer.skip_token (); - } + lexer.skip_token (); /* TODO: do I even need to store the result of this? can't be used. * If semantically different, I need a wrapped "match arm patterns" object for * this. */ diff --git a/gcc/rust/resolve/rust-ast-resolve-item.h b/gcc/rust/resolve/rust-ast-resolve-item.h index 1074031..45d94db 100644 --- a/gcc/rust/resolve/rust-ast-resolve-item.h +++ b/gcc/rust/resolve/rust-ast-resolve-item.h @@ -39,6 +39,22 @@ public: item->accept_vis (resolver); }; + void visit (AST::TypeAlias &alias) override + { + NodeId scope_node_id = alias.get_node_id (); + resolver->get_type_scope ().push (scope_node_id); + + if (alias.has_generics ()) + { + for (auto &generic : alias.get_generic_params ()) + ResolveGenericParam::go (generic.get (), alias.get_node_id ()); + } + + ResolveType::go (alias.get_type_aliased ().get (), alias.get_node_id ()); + + resolver->get_type_scope ().pop (); + } + void visit (AST::TupleStruct &struct_decl) override { NodeId scope_node_id = struct_decl.get_node_id (); diff --git a/gcc/rust/resolve/rust-ast-resolve-toplevel.h b/gcc/rust/resolve/rust-ast-resolve-toplevel.h index 8baab13..afc0068 100644 --- a/gcc/rust/resolve/rust-ast-resolve-toplevel.h +++ b/gcc/rust/resolve/rust-ast-resolve-toplevel.h @@ -38,6 +38,16 @@ public: item->accept_vis (resolver); }; + void visit (AST::TypeAlias &alias) override + { + resolver->get_type_scope ().insert ( + alias.get_new_type_name (), alias.get_node_id (), alias.get_locus (), + false, [&] (std::string, NodeId, Location locus) -> void { + rust_error_at (alias.get_locus (), "redefined multiple times"); + rust_error_at (locus, "was defined here"); + }); + } + void visit (AST::TupleStruct &struct_decl) override { resolver->get_type_scope ().insert ( diff --git a/gcc/rust/rust-diagnostics.cc b/gcc/rust/rust-diagnostics.cc index 8bcaef6..ab498c9 100644 --- a/gcc/rust/rust-diagnostics.cc +++ b/gcc/rust/rust-diagnostics.cc @@ -189,6 +189,9 @@ rust_inform (const Location location, const char *fmt, ...) // rust_debug uses normal printf formatting, not GCC diagnostic formatting. void +rust_debug (const Location location, const char *fmt, ...) ATTRIBUTE_PRINTF_2; + +void rust_debug (const Location location, const char *fmt, ...) { va_list ap; diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index b8742fb..885fa60 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -28,7 +28,19 @@ #include "tm.h" #include "tm_p.h" -#include "rust-target.h" +//#include "rust-target.h" +/*TODO This isn't (currently?) necessary, but if '#include'd after '#include + "target.h"', causes: In file included from + [...]/gcc/rust/rust-session-manager.cc:31: + [...]/gcc/rust/rust-target.h:23: error: "DEFHOOK" redefined [-Werror] + 23 | #define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (*NAME) PARAMS; + | + In file included from [...]/gcc/rust/rust-session-manager.cc:27: + [...]/gcc/target.h:272: note: this is the location of the previous + definition 272 | #define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) + PARAMS; + | +*/ #include "rust-lex.h" #include "rust-parse.h" @@ -121,7 +133,6 @@ void Session::enable_features () { bool has_target_crt_static = false; - const char *target = "PLACEHOLDER"; fprintf ( stderr, diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.h b/gcc/rust/typecheck/rust-hir-type-check-expr.h index b6048a9..10602b4 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-expr.h +++ b/gcc/rust/typecheck/rust-hir-type-check-expr.h @@ -118,10 +118,6 @@ public: } infered = field_tyty->get_field_type (); - printf ("ZXZX resolved: %s to: \n", expr.as_string ().c_str ()); - adt->debug (); - infered->debug (); - printf ("ZXZX done\n"); } void visit (HIR::TupleExpr &expr) override @@ -250,7 +246,7 @@ public: if (receiver_tyty->get_kind () == TyTy::TypeKind::ADT) { TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (receiver_tyty); - if (adt->has_substitutions ()) + if (adt->has_substitutions () && fn->needs_substitution ()) { rust_assert (adt->was_substituted ()); lookup diff --git a/gcc/rust/typecheck/rust-hir-type-check-implitem.h b/gcc/rust/typecheck/rust-hir-type-check-implitem.h index dd62622..7e9e862 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-implitem.h +++ b/gcc/rust/typecheck/rust-hir-type-check-implitem.h @@ -242,15 +242,12 @@ public: auto expected_ret_tyty = resolve_fn_type->get_return_type (); context->push_return_type (expected_ret_tyty); - printf ("XXXX method body boyo: 1!!\n"); - auto block_expr_ty = TypeCheckExpr::Resolve (method.get_definition ().get (), false); context->pop_return_type (); expected_ret_tyty->unify (block_expr_ty); - printf ("XXXX method body boyo: 2!!\n"); } private: diff --git a/gcc/rust/typecheck/rust-hir-type-check-toplevel.h b/gcc/rust/typecheck/rust-hir-type-check-toplevel.h index 702c6c7..0131555 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-toplevel.h +++ b/gcc/rust/typecheck/rust-hir-type-check-toplevel.h @@ -40,6 +40,14 @@ public: item->accept_vis (resolver); } + void visit (HIR::TypeAlias &alias) override + { + TyTy::BaseType *actual_type + = TypeCheckType::Resolve (alias.get_type_aliased ().get ()); + + context->insert_type (alias.get_mappings (), actual_type); + } + void visit (HIR::TupleStruct &struct_decl) override { std::vector<TyTy::SubstitutionParamMapping> substitutions; diff --git a/gcc/rust/typecheck/rust-hir-type-check.cc b/gcc/rust/typecheck/rust-hir-type-check.cc index b105269..8b2f657 100644 --- a/gcc/rust/typecheck/rust-hir-type-check.cc +++ b/gcc/rust/typecheck/rust-hir-type-check.cc @@ -305,19 +305,27 @@ TypeCheckStructExpr::visit (HIR::PathInExpression &expr) if (struct_path_resolved->has_substitutions ()) { HIR::PathExprSegment seg = expr.get_final_segment (); - - TyTy::BaseType *subst - = SubstMapper::Resolve (struct_path_resolved, expr.get_locus (), - seg.has_generic_args () - ? &seg.get_generic_args () - : nullptr); - if (subst == nullptr || subst->get_kind () != TyTy::TypeKind::ADT) + if (!struct_path_resolved->needs_substitution () + && seg.has_generic_args ()) { - rust_fatal_error (mappings->lookup_location (ref), - "expected a substituted ADT type"); - return; + rust_error_at (seg.get_generic_args ().get_locus (), + "unexpected type arguments"); + } + else if (struct_path_resolved->needs_substitution ()) + { + TyTy::BaseType *subst + = SubstMapper::Resolve (struct_path_resolved, expr.get_locus (), + seg.has_generic_args () + ? &seg.get_generic_args () + : nullptr); + if (subst == nullptr || subst->get_kind () != TyTy::TypeKind::ADT) + { + rust_fatal_error (mappings->lookup_location (ref), + "expected a substituted ADT type"); + return; + } + struct_path_resolved = static_cast<TyTy::ADTType *> (subst); } - struct_path_resolved = static_cast<TyTy::ADTType *> (subst); } } diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index 58baee9..ae17baf 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -362,17 +362,15 @@ ADTType * ADTType::handle_substitions (SubstitutionArgumentMappings subst_mappings) { if (subst_mappings.size () != get_num_substitutions ()) - { rust_error_at (subst_mappings.get_locus (), "invalid number of generic arguments to generic ADT type"); return nullptr; } - used_arguments = subst_mappings; - ADTType *adt = static_cast<ADTType *> (clone ()); adt->set_ty_ref (mappings->get_next_hir_id ()); + adt->used_arguments = subst_mappings; for (auto &sub : adt->get_substs ()) { @@ -566,15 +564,15 @@ FnType::handle_substitions (SubstitutionArgumentMappings subst_mappings) { if (subst_mappings.size () != get_num_substitutions ()) { - rust_error_at (subst_mappings.get_locus (), - "invalid number of generic arguments to generic ADT type"); + rust_error_at ( + subst_mappings.get_locus (), + "invalid number of generic arguments to generic Function type"); return nullptr; } - used_arguments = subst_mappings; - FnType *fn = static_cast<FnType *> (clone ()); fn->set_ty_ref (mappings->get_next_hir_id ()); + fn->used_arguments = subst_mappings; for (auto &sub : fn->get_substs ()) { diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index ac5a766..596b95d 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -527,7 +527,12 @@ public: } } - bool was_substituted () const { return !used_arguments.is_error (); } + bool needs_substitution () const + { + return has_substitutions () && used_arguments.is_error (); + } + + bool was_substituted () const { return !needs_substitution (); } SubstitutionArgumentMappings get_substitution_arguments () { @@ -966,11 +971,21 @@ class USizeType : public BaseType public: USizeType (HirId ref, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ref, TypeKind::USIZE) - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } USizeType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ty_ref, TypeKind::USIZE) - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } void accept_vis (TyVisitor &vis) override; @@ -988,11 +1003,21 @@ class ISizeType : public BaseType public: ISizeType (HirId ref, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ref, TypeKind::ISIZE) - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } ISizeType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ty_ref, TypeKind::ISIZE) - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } void accept_vis (TyVisitor &vis) override; @@ -1010,12 +1035,21 @@ class CharType : public BaseType public: CharType (HirId ref, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ref, TypeKind::CHAR) - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } CharType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ty_ref, TypeKind::CHAR) - - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } void accept_vis (TyVisitor &vis) override; @@ -1034,12 +1068,22 @@ public: ReferenceType (HirId ref, TyVar base, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ref, TypeKind::REF), base (base) - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } ReferenceType (HirId ref, HirId ty_ref, TyVar base, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ty_ref, TypeKind::REF), base (base) - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } BaseType *get_base () const; @@ -1064,11 +1108,21 @@ class StrType : public BaseType public: StrType (HirId ref, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ref, TypeKind::STR) - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } StrType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ()) : BaseType (ref, ty_ref, TypeKind::STR) - {} + { + // TODO unused; should 'refs' be passed as the last argument to the + // 'BaseType' constructor call? Potential change in behavior (if 'refs' is + // provided by caller)? + (void) refs; + } std::string get_name () const override final { return as_string (); } |