LCOV - code coverage report
Current view: top level - gcc/rust/hir - rust-hir-dump.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 0.0 % 1540 0
Test Date: 2026-02-28 14:20:25 Functions: 0.0 % 190 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // Copyright (C) 2020-2026 Free Software Foundation, Inc.
       2              : 
       3              : // This file is part of GCC.
       4              : 
       5              : // GCC is free software; you can redistribute it and/or modify it under
       6              : // the terms of the GNU General Public License as published by the Free
       7              : // Software Foundation; either version 3, or (at your option) any later
       8              : // version.
       9              : 
      10              : // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      11              : // WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12              : // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      13              : // for more details.
      14              : 
      15              : // You should have received a copy of the GNU General Public License
      16              : // along with GCC; see the file COPYING3.  If not see
      17              : // <http://www.gnu.org/licenses/>.
      18              : 
      19              : #include "rust-hir-dump.h"
      20              : #include "rust-abi.h"
      21              : #include "rust-hir-item.h"
      22              : #include "rust-hir-path.h"
      23              : #include "rust-hir-type.h"
      24              : #include "rust-hir.h"
      25              : #include "rust-attribute-values.h"
      26              : #include "tree/rust-hir-expr.h"
      27              : #include "rust-system.h"
      28              : 
      29              : namespace Rust {
      30              : namespace HIR {
      31              : 
      32              : // Dump Format for HIR
      33              : //
      34              : // SomeHIRNode [
      35              : //    field: ...
      36              : //    field: ...
      37              : //    field: ...
      38              : // ]
      39              : //
      40              : // When a field is a collection of other HIR objects:
      41              : //   field {
      42              : //     SomeHIRNode [ ... ]
      43              : //     SomeOtherHIRNode [ ... ]
      44              : //   }
      45              : //
      46              : // If a field is an empty collection:
      47              : //  field: empty
      48              : //
      49              : // If a field is optional and is currently not holding anything:
      50              : //   field: none
      51              : 
      52              : std::string Dump::delims[2][2] = {
      53              :   {std::string ("{"), std::string ("}")},
      54              :   {std::string ("["), std::string ("]")},
      55              : };
      56              : 
      57              : static std::string
      58            0 : BoundPolarityString (BoundPolarity polarity)
      59              : {
      60            0 :   switch (polarity)
      61              :     {
      62            0 :     case RegularBound:
      63            0 :       return "regular";
      64            0 :     case NegativeBound:
      65            0 :       return "negative";
      66            0 :     case AntiBound:
      67            0 :       return "anti";
      68              :     }
      69            0 :   return "unknown";
      70              : }
      71              : 
      72              : /**
      73              :  * Static member used to dump HIR from the debugger to stderr.
      74              :  *
      75              :  * @param v The HIR node to dump
      76              :  */
      77              : void
      78            0 : Dump::debug (FullVisitable &v)
      79              : {
      80            0 :   Dump dump (std::cerr);
      81            0 :   v.accept_vis (dump);
      82            0 : }
      83              : 
      84              : void
      85            0 : Dump::go (HIR::Crate &e)
      86              : {
      87            0 :   begin ("Crate");
      88            0 :   do_inner_attrs (e);
      89            0 :   do_mappings (e.get_mappings ());
      90              : 
      91            0 :   visit_collection ("items", e.get_items ());
      92            0 :   end ("Crate");
      93            0 : }
      94              : 
      95            0 : Dump::Dump (std::ostream &stream) : beg_of_line (false), stream (stream) {}
      96              : 
      97              : /**
      98              :  * Writes TEXT with a final newline if ENDLINE is true.
      99              :  * If TEXT is starting the current line, its first line is indented.
     100              :  * If TEXT is multiline, all followning lines are also indented.
     101              :  *
     102              :  * @param text Text to emit
     103              :  * @param endline If true, newline is emitted after text
     104              :  */
     105              : void
     106            0 : Dump::put (std::string text, bool endline)
     107              : {
     108            0 :   if (beg_of_line)
     109              :     {
     110            0 :       stream << indentation;
     111            0 :       beg_of_line = false;
     112              :     }
     113              : 
     114              :   // keep multiline string indented
     115            0 :   std::string::size_type pos = 0;
     116              :   std::string::size_type prev = 0;
     117              :   auto first = true;
     118            0 :   while ((pos = text.find ('\n', prev)) != std::string::npos)
     119              :     {
     120            0 :       if (!first)
     121            0 :         stream << std::endl << indentation;
     122            0 :       first = false;
     123              : 
     124            0 :       stream << text.substr (prev, pos - prev);
     125            0 :       prev = pos + 1;
     126              :     }
     127              : 
     128            0 :   if (first)
     129            0 :     stream << text;
     130              : 
     131            0 :   if (endline)
     132              :     {
     133            0 :       stream << std::endl;
     134            0 :       beg_of_line = endline;
     135              :     }
     136            0 : }
     137              : 
     138              : /**
     139              :  * Called when starting to emit info for an HIR node.
     140              :  * Emits NAME and an opening delimiter denoted by D.
     141              :  *
     142              :  * @param name Name of HIR node
     143              :  * @param d Delimiter
     144              :  */
     145              : void
     146            0 : Dump::begin (std::string name, enum delim d)
     147              : {
     148            0 :   if (!beg_of_line)
     149            0 :     put ("");
     150            0 :   put (name + " " + delims[d][0], true);
     151            0 :   indentation.increment ();
     152            0 : }
     153              : 
     154              : /**
     155              :  * Called when ending the dump info for an HIR node. Emits a C++-style
     156              :  * comment with NAME and a closing delimiter denoted by D.
     157              :  *
     158              :  * @param name Name of HIR node
     159              :  * @param d Delimiter
     160              :  */
     161              : void
     162            0 : Dump::end (std::string name, enum delim d)
     163              : {
     164            0 :   indentation.decrement ();
     165            0 :   if (!beg_of_line)
     166            0 :     stream << std::endl;
     167            0 :   put (delims[d][1] + " // " + name);
     168            0 : }
     169              : 
     170              : /**
     171              :  * Called when starting to emit info for a field within an HIR node.
     172              :  * Emits NAME and an opening curly brace
     173              :  *
     174              :  * @param name HIR field name
     175              :  */
     176              : void
     177            0 : Dump::begin_field (std::string name)
     178              : {
     179            0 :   begin (name, CURLY);
     180            0 : }
     181              : 
     182              : /**
     183              :  * Called when ending the dump info for a field within an HIR node.
     184              :  * Emits a C++-style comment with NAME and a closing curly brace
     185              :  *
     186              :  * @param name HIR field name
     187              :  */
     188              : void
     189            0 : Dump::end_field (std::string name)
     190              : {
     191            0 :   end (name, CURLY);
     192            0 : }
     193              : 
     194              : /**
     195              :  * Emits a single field/value pair denoted by NAME and TEXT.
     196              :  *
     197              :  * @param name Field name
     198              :  * @param text Field value
     199              :  */
     200              : void
     201            0 : Dump::put_field (std::string name, std::string text)
     202              : {
     203            0 :   put (name + ": ", false);
     204            0 :   indentation.increment ();
     205            0 :   put (text);
     206            0 :   indentation.decrement ();
     207            0 : }
     208              : 
     209              : /**
     210              :  * Recursively visits an HIR field NAME with value possibly pointed to by
     211              :  * PTR, if PTR is not null. If PTR is null, simply emits FIELD_NAME/NULL pair.
     212              :  *
     213              :  * @param name Field name
     214              :  * @param ptr Pointer to field's value
     215              :  */
     216              : template <class T>
     217              : void
     218            0 : Dump::visit_field (std::string name, std::unique_ptr<T> &ptr)
     219              : {
     220            0 :   if (ptr)
     221            0 :     visit_field (name, *ptr);
     222              :   else
     223            0 :     put_field (name, "NULL");
     224            0 : }
     225              : 
     226              : /**
     227              :  * Recursively visits an HIR field NAME with value V.
     228              :  *
     229              :  * @param name Field name
     230              :  * @param v Field value
     231              :  */
     232              : void
     233            0 : Dump::visit_field (std::string name, FullVisitable &v)
     234              : {
     235            0 :   put (name + ": ", false);
     236            0 :   indentation.increment ();
     237            0 :   v.accept_vis (*this);
     238            0 :   indentation.decrement ();
     239            0 : }
     240              : 
     241              : /**
     242              :  * Recursively visits a collection VEC of HIR node for field NAME.
     243              :  * If VEC is empty, simply emits the NAME/empty pair.
     244              :  *
     245              :  * @param name Field name
     246              :  * @param vec Field value as a vector
     247              :  */
     248              : template <class T>
     249              : void
     250            0 : Dump::visit_collection (std::string name, std::vector<std::unique_ptr<T>> &vec)
     251              : {
     252            0 :   if (vec.empty ())
     253              :     {
     254            0 :       put_field (name, "empty");
     255            0 :       return;
     256              :     }
     257              : 
     258            0 :   begin_field (name);
     259            0 :   for (const auto &elt : vec)
     260            0 :     elt->accept_vis (*this);
     261            0 :   end_field (name);
     262              : }
     263              : 
     264              : /**
     265              :  * Recursively visits a collection VEC of HIR node for field NAME.
     266              :  * If VEC is empty, simply emits the NAME/empty pair.
     267              :  *
     268              :  * @param name Field name
     269              :  * @param vec Field value as a vector
     270              :  */
     271              : template <class T>
     272              : void
     273            0 : Dump::visit_collection (std::string name, std::vector<T> &vec)
     274              : {
     275            0 :   if (vec.empty ())
     276              :     {
     277            0 :       put_field (name, "empty");
     278            0 :       return;
     279              :     }
     280              : 
     281            0 :   begin_field (name);
     282            0 :   for (auto &elt : vec)
     283            0 :     elt.accept_vis (*this);
     284            0 :   end_field (name);
     285              : }
     286              : 
     287              : void
     288            0 : Dump::do_traititem (TraitItem &e)
     289              : {
     290            0 :   do_mappings (e.get_mappings ());
     291            0 :   auto oa = e.get_outer_attrs ();
     292            0 :   do_outer_attrs (oa);
     293            0 : }
     294              : 
     295              : void
     296            0 : Dump::do_vis_item (VisItem &e)
     297              : {
     298            0 :   do_item (e);
     299            0 :   std::string str = "none";
     300            0 :   if (e.has_visibility ())
     301            0 :     str = e.get_visibility ().to_string ();
     302            0 :   put_field ("visibility", str);
     303            0 : }
     304              : 
     305              : void
     306            0 : Dump::do_functionparam (FunctionParam &e)
     307              : {
     308            0 :   begin ("FunctionParam");
     309            0 :   do_mappings (e.get_mappings ());
     310            0 :   visit_field ("param_name", e.get_param_name ());
     311            0 :   visit_field ("type", e.get_type ());
     312            0 :   end ("FunctionParam");
     313            0 : }
     314              : 
     315              : void
     316            0 : Dump::do_pathpattern (PathPattern &e)
     317              : {
     318            0 :   if (e.get_path_kind () == PathPattern::Kind::LangItem)
     319              :     {
     320            0 :       put_field ("segments", "#[lang = \""
     321            0 :                                + LangItem::ToString (e.get_lang_item ())
     322            0 :                                + "\"]");
     323            0 :       return;
     324              :     }
     325              : 
     326            0 :   std::string str = "";
     327              : 
     328            0 :   for (const auto &segment : e.get_segments ())
     329            0 :     str += segment.to_string () + ", ";
     330              : 
     331            0 :   put_field ("segments", str);
     332            0 : }
     333              : 
     334              : void
     335            0 : Dump::do_structexprstruct (StructExprStruct &e)
     336              : {
     337            0 :   do_expr (e);
     338              : 
     339              :   // StructExpr
     340            0 :   visit_field ("struct_name", e.get_struct_name ());
     341              : 
     342              :   // StructExprStruct
     343            0 :   do_mappings (e.get_mappings ());
     344            0 :   do_inner_attrs (e);
     345            0 : }
     346              : 
     347              : void
     348            0 : Dump::do_ifexpr (IfExpr &e)
     349              : {
     350            0 :   do_expr (e);
     351            0 :   visit_field ("condition", e.get_if_condition ());
     352            0 :   visit_field ("if_block", e.get_if_block ());
     353            0 : }
     354              : 
     355              : void
     356            0 : Dump::do_expr (Expr &e)
     357              : {
     358            0 :   do_mappings (e.get_mappings ());
     359            0 :   auto oa = e.get_outer_attrs ();
     360            0 :   do_outer_attrs (oa);
     361            0 : }
     362              : 
     363              : void
     364            0 : Dump::do_matcharm (MatchArm &e)
     365              : {
     366            0 :   begin ("MatchArm");
     367              :   // FIXME Can't remember how to handle that. Let's see later.
     368              :   // do_outer_attrs(e);
     369            0 :   visit_field ("match_arm_pattern", e.get_pattern ());
     370            0 :   if (e.has_match_arm_guard ())
     371            0 :     visit_field ("guard_expr", e.get_guard_expr ());
     372            0 :   end ("MatchArm");
     373            0 : }
     374              : 
     375              : void
     376            0 : Dump::do_matchcase (HIR::MatchCase &e)
     377              : {
     378            0 :   begin ("MatchCase");
     379              : 
     380            0 :   begin_field ("arm");
     381            0 :   do_matcharm (e.get_arm ());
     382            0 :   end_field ("arm");
     383              : 
     384            0 :   visit_field ("expr", e.get_expr ());
     385              : 
     386            0 :   end ("MatchCase");
     387            0 : }
     388              : 
     389              : void
     390            0 : Dump::do_pathexpr (PathExpr &e)
     391              : {
     392            0 :   do_expr (e);
     393            0 : }
     394              : 
     395              : void
     396            0 : Dump::do_typepathsegment (TypePathSegment &e)
     397              : {
     398            0 :   do_mappings (e.get_mappings ());
     399            0 :   if (e.is_lang_item ())
     400            0 :     put_field ("ident_segment", LangItem::PrettyString (e.get_lang_item ()));
     401              :   else
     402            0 :     put_field ("ident_segment", e.get_ident_segment ().to_string ());
     403            0 : }
     404              : 
     405              : void
     406            0 : Dump::do_typepathfunction (TypePathFunction &e)
     407              : {
     408            0 :   visit_collection ("params", e.get_params ());
     409            0 :   visit_field ("return_type", e.get_return_type ());
     410            0 : }
     411              : 
     412              : void
     413            0 : Dump::do_qualifiedpathtype (QualifiedPathType &e)
     414              : {
     415            0 :   do_mappings (e.get_mappings ());
     416            0 :   if (e.has_type ())
     417            0 :     visit_field ("type", e.get_type ());
     418              :   else
     419            0 :     put_field ("type", "none");
     420              : 
     421            0 :   if (e.has_trait ())
     422            0 :     visit_field ("trait", e.get_trait ());
     423            0 : }
     424              : 
     425              : void
     426            0 : Dump::do_operatorexpr (OperatorExpr &e)
     427              : {
     428            0 :   visit_field ("main_or_left_expr", e.get_expr ());
     429            0 : }
     430              : 
     431              : void
     432            0 : Dump::do_mappings (const Analysis::NodeMapping &mappings)
     433              : {
     434            0 :   put ("mapping: ", false);
     435            0 :   put (mappings.as_string ());
     436            0 : }
     437              : 
     438              : void
     439            0 : Dump::do_inner_attrs (WithInnerAttrs &e)
     440              : {
     441            0 :   auto attrs = e.get_inner_attrs ();
     442              : 
     443            0 :   if (attrs.empty ())
     444              :     {
     445            0 :       put_field ("inner_attrs", "empty");
     446            0 :       return;
     447              :     }
     448              : 
     449            0 :   begin_field ("inner_attrs");
     450            0 :   for (auto &elt : attrs)
     451            0 :     visit (elt);
     452            0 :   end_field ("inner_attrs");
     453            0 : }
     454              : 
     455              : void
     456            0 : Dump::do_outer_attrs (std::vector<AST::Attribute> &attrs)
     457              : {
     458            0 :   if (attrs.empty ())
     459            0 :     put_field ("outer_attributes", "empty");
     460              :   else
     461              :     {
     462            0 :       begin_field ("outer_attributes");
     463            0 :       for (const auto &attr : attrs)
     464            0 :         put (attr.as_string ());
     465            0 :       end_field ("outer_attributes");
     466              :     }
     467            0 : }
     468              : 
     469              : void
     470            0 : Dump::do_baseloopexpr (BaseLoopExpr &e)
     471              : {
     472            0 :   do_expr (e);
     473              : 
     474            0 :   if (!e.has_loop_label ())
     475            0 :     put_field ("label", "none");
     476              :   else
     477            0 :     put_field ("label", e.get_loop_label ().to_string ());
     478              : 
     479            0 :   visit_field ("loop_block", e.get_loop_block ());
     480            0 : }
     481              : 
     482              : void
     483            0 : Dump::do_struct (Struct &e)
     484              : {
     485            0 :   do_vis_item (e);
     486            0 :   put_field ("struct_name", e.get_identifier ().as_string ());
     487            0 :   visit_collection ("generic_params", e.get_generic_params ());
     488              : 
     489            0 :   if (!e.has_where_clause ())
     490            0 :     put_field ("where_clause", "none");
     491              :   else
     492            0 :     put_field ("where clause", e.get_where_clause ().to_string ());
     493            0 : }
     494              : 
     495              : void
     496            0 : Dump::do_enumitem (EnumItem &e)
     497              : {
     498            0 :   do_item (e);
     499              : 
     500            0 :   put_field ("variant_name", e.get_identifier ().as_string ());
     501              : 
     502            0 :   std::string str;
     503            0 :   switch (e.get_enum_item_kind ())
     504              :     {
     505            0 :     case EnumItem::EnumItemKind::Named:
     506            0 :       str = "[Named variant]";
     507            0 :       break;
     508            0 :     case EnumItem::EnumItemKind::Tuple:
     509            0 :       str = "[Tuple variant]";
     510            0 :       break;
     511            0 :     case EnumItem::EnumItemKind::Struct:
     512            0 :       str = "[Struct variant]";
     513            0 :       break;
     514            0 :     case EnumItem::EnumItemKind::Discriminant:
     515            0 :       str = "[Discriminant variant]";
     516            0 :       break;
     517              :     }
     518            0 :   put_field ("item_kind", str);
     519            0 : }
     520              : 
     521              : void
     522            0 : Dump::do_traitfunctiondecl (TraitFunctionDecl &e)
     523              : {
     524            0 :   begin ("TraitFunctionDecl");
     525            0 :   put_field ("qualifiers", e.get_qualifiers ().to_string ());
     526            0 :   put_field ("function_name", e.get_function_name ().as_string ());
     527            0 :   visit_collection ("generic_params", e.get_generic_params ());
     528              : 
     529            0 :   if (!e.get_function_params ().empty ())
     530              :     {
     531            0 :       begin_field ("function_params");
     532            0 :       for (auto &item : e.get_function_params ())
     533            0 :         do_functionparam (item);
     534            0 :       end_field ("function_params");
     535              :     }
     536              :   else
     537            0 :     put_field ("function_params", "empty");
     538              : 
     539            0 :   if (e.has_return_type ())
     540            0 :     visit_field ("return_type", e.get_return_type ());
     541              :   else
     542            0 :     put_field ("return_type", "none");
     543              : 
     544            0 :   if (e.has_where_clause ())
     545            0 :     put_field ("where_clause", e.get_where_clause ().to_string ());
     546              :   else
     547            0 :     put_field ("where_clause", "none");
     548              : 
     549            0 :   if (e.is_method ())
     550            0 :     put_field ("self", e.get_self_unchecked ().to_string ());
     551              : 
     552            0 :   end ("TraitFunctionDecl");
     553            0 : }
     554              : 
     555              : void
     556            0 : Dump::do_externalitem (ExternalItem &e)
     557              : {
     558            0 :   do_mappings (e.get_mappings ());
     559              : 
     560            0 :   auto oa = e.get_outer_attrs ();
     561            0 :   do_outer_attrs (oa);
     562              : 
     563            0 :   std::string str = "none";
     564            0 :   if (e.has_visibility ())
     565            0 :     str = e.get_visibility ().to_string ();
     566            0 :   put_field ("visibility", str);
     567            0 :   put_field ("item_name", e.get_item_name ().as_string ());
     568            0 : }
     569              : 
     570              : void
     571            0 : Dump::do_namefunctionparam (NamedFunctionParam &e)
     572              : {
     573            0 :   begin ("NamedFunctionParam");
     574            0 :   do_mappings (e.get_mappings ());
     575            0 :   put_field ("name", e.get_param_name ().as_string ());
     576            0 :   visit_field ("type", e.get_type ());
     577            0 :   end ("NamedFunctionParam");
     578            0 : }
     579              : 
     580              : void
     581            0 : Dump::do_stmt (Stmt &e)
     582              : {
     583            0 :   do_mappings (e.get_mappings ());
     584            0 : }
     585              : 
     586              : void
     587            0 : Dump::do_type (Type &e)
     588              : {
     589            0 :   do_mappings (e.get_mappings ());
     590            0 : }
     591              : 
     592              : void
     593            0 : Dump::do_item (Item &e)
     594              : {
     595            0 :   do_stmt (e);
     596            0 :   auto oa = e.get_outer_attrs ();
     597            0 :   do_outer_attrs (oa);
     598            0 : }
     599              : 
     600              : void
     601            0 : Dump::do_tuplefield (TupleField &e)
     602              : {
     603            0 :   do_mappings (e.get_mappings ());
     604            0 :   auto oa = e.get_outer_attrs ();
     605            0 :   do_outer_attrs (oa);
     606              : 
     607            0 :   std::string str = "none";
     608            0 :   if (e.has_visibility ())
     609            0 :     str = e.get_visibility ().to_string ();
     610            0 :   put_field ("visibility", str);
     611              : 
     612            0 :   visit_field ("field_type", e.get_field_type ());
     613            0 : }
     614              : 
     615              : void
     616            0 : Dump::do_structfield (StructField &e)
     617              : {
     618            0 :   do_mappings (e.get_mappings ());
     619            0 :   auto oa = e.get_outer_attrs ();
     620            0 :   do_outer_attrs (oa);
     621              : 
     622            0 :   std::string str = "none";
     623            0 :   if (e.has_visibility ())
     624            0 :     str = e.get_visibility ().to_string ();
     625            0 :   put_field ("visibility", str);
     626            0 :   put_field ("field_name", e.get_field_name ().as_string ());
     627            0 :   visit_field ("field_type", e.get_field_type ());
     628            0 : }
     629              : 
     630              : void
     631            0 : Dump::do_genericargs (GenericArgs &e)
     632              : {
     633            0 :   visit_collection ("lifetime_args", e.get_lifetime_args ());
     634            0 :   visit_collection ("type_args", e.get_type_args ());
     635              : 
     636            0 :   if (e.get_const_args ().empty ())
     637              :     {
     638            0 :       put_field ("binding_args", "empty");
     639              :     }
     640              :   else
     641              :     {
     642            0 :       begin_field ("const_args");
     643            0 :       for (auto &arg : e.get_const_args ())
     644              :         {
     645            0 :           begin ("ConstGenericArg");
     646            0 :           visit_field ("expression", arg.get_expression ());
     647            0 :           end ("ConstGenericArg");
     648              :         }
     649            0 :       end_field ("const_args");
     650              :     }
     651              : 
     652            0 :   if (e.get_binding_args ().empty ())
     653              :     {
     654            0 :       put_field ("binding_args", "empty");
     655              :     }
     656              :   else
     657              :     {
     658            0 :       begin_field ("binding_args");
     659            0 :       for (auto &arg : e.get_binding_args ())
     660              :         {
     661            0 :           begin ("GenericArgsBinding");
     662            0 :           put_field ("identfier", arg.get_identifier ().as_string ());
     663            0 :           visit_field ("type", arg.get_type ());
     664            0 :           end ("GenericArgsBinding");
     665              :         }
     666            0 :       end_field ("binding_args");
     667              :     }
     668            0 : }
     669              : 
     670              : void
     671            0 : Dump::do_maybenamedparam (MaybeNamedParam &e)
     672              : {
     673            0 :   visit_field ("param_type", e.get_type ());
     674            0 :   put_field ("param_kind", enum_to_str (e.get_param_kind ()));
     675            0 :   put_field ("name", e.get_name ().as_string ());
     676            0 : }
     677              : 
     678              : // All visit methods
     679              : 
     680              : void
     681            0 : Dump::visit (AST::Attribute &attribute)
     682              : {
     683              :   // Special, no begin/end as this is called by do_inner_attrs.
     684            0 :   put_field (Values::Attributes::PATH, attribute.get_path ().as_string ());
     685              : 
     686            0 :   std::string str = "none";
     687            0 :   if (attribute.has_attr_input ())
     688            0 :     str = attribute.get_attr_input ().as_string ();
     689            0 :   put_field ("attr_input", str);
     690            0 : }
     691              : 
     692              : void
     693            0 : Dump::visit (Lifetime &e)
     694              : {
     695            0 :   do_mappings (e.get_mappings ());
     696              : 
     697            0 :   std::string type;
     698            0 :   std::string name = e.get_name ();
     699            0 :   switch (e.get_lifetime_type ())
     700              :     {
     701            0 :     case AST::Lifetime::LifetimeType::NAMED:
     702            0 :       type = "[NAMED]";
     703            0 :       break;
     704            0 :     case AST::Lifetime::LifetimeType::STATIC:
     705            0 :       type = "[STATIC]";
     706            0 :       name += " (not applicable for type)";
     707            0 :       break;
     708            0 :     case AST::Lifetime::LifetimeType::WILDCARD:
     709            0 :       type = "[WILDCARD]";
     710            0 :       name += " (not applicable for type)";
     711            0 :       break;
     712            0 :     default:
     713            0 :       rust_assert (false);
     714              :       break;
     715              :     }
     716            0 :   put_field ("lifetime_type", type);
     717            0 :   put_field ("lifetime_name", name);
     718            0 : }
     719              : 
     720              : void
     721            0 : Dump::visit (LifetimeParam &lifetimeparam)
     722              : {
     723            0 :   begin ("Lifetimeparam");
     724            0 :   put (lifetimeparam.to_debug_string ());
     725            0 :   end ("Lifetimeparam");
     726            0 : }
     727              : 
     728              : void
     729            0 : Dump::visit (PathInExpression &e)
     730              : {
     731            0 :   begin ("PathInExpression");
     732            0 :   do_pathpattern (e);
     733            0 :   do_pathexpr (e);
     734              : 
     735            0 :   put_field ("has_opening_scope_resolution",
     736            0 :              std::to_string (e.opening_scope_resolution ()));
     737            0 :   end ("PathInExpression");
     738            0 : }
     739              : 
     740              : void
     741            0 : Dump::visit (TypePathSegment &e)
     742              : {
     743            0 :   begin ("TypePathSegment");
     744            0 :   do_typepathsegment (e);
     745            0 :   end ("TypePathSegment");
     746            0 : }
     747              : 
     748              : void
     749            0 : Dump::visit (TypePathSegmentGeneric &e)
     750              : {
     751            0 :   begin ("TypePathSegmentGeneric");
     752            0 :   do_typepathsegment (e);
     753              : 
     754            0 :   if (e.has_generic_args ())
     755              :     {
     756            0 :       begin_field ("generic_args");
     757            0 :       begin ("GenericArgs");
     758            0 :       do_genericargs (e.get_generic_args ());
     759            0 :       end ("GenericArgs");
     760            0 :       end_field ("generic_args");
     761              :     }
     762              :   else
     763              :     {
     764            0 :       put_field ("generic_args", "empty");
     765              :     }
     766              : 
     767            0 :   end ("TypePathSegmentGeneric");
     768            0 : }
     769              : 
     770              : void
     771            0 : Dump::visit (TypePathSegmentFunction &e)
     772              : {
     773            0 :   begin ("TypePathSegmentFunction");
     774            0 :   do_typepathsegment (e);
     775              : 
     776            0 :   begin ("function_path");
     777            0 :   do_typepathfunction (e.get_function_path ());
     778            0 :   end ("function_path");
     779              : 
     780            0 :   end ("TypePathSegmentFunction");
     781            0 : }
     782              : 
     783              : void
     784            0 : Dump::visit (TypePath &e)
     785              : {
     786            0 :   begin ("TypePath");
     787            0 :   put_field ("has_opening_scope_resolution",
     788            0 :              std::to_string (e.has_opening_scope_resolution_op ()));
     789              : 
     790            0 :   visit_collection ("segments", e.get_segments ());
     791              : 
     792            0 :   end ("TypePath");
     793            0 : }
     794              : 
     795              : void
     796            0 : Dump::visit (QualifiedPathInExpression &e)
     797              : {
     798            0 :   begin ("QualifiedPathInExpression");
     799            0 :   do_pathpattern (e);
     800            0 :   do_expr (e);
     801              : 
     802            0 :   begin_field ("path_type");
     803              : 
     804            0 :   begin ("QualifiedPathType");
     805            0 :   do_qualifiedpathtype (e.get_path_type ());
     806            0 :   end ("QualifiedPathType");
     807              : 
     808            0 :   end_field ("path_type");
     809              : 
     810            0 :   end ("QualifiedPathInExpression");
     811            0 : }
     812              : 
     813              : void
     814            0 : Dump::visit (QualifiedPathInType &e)
     815              : {
     816            0 :   begin ("QualifiedPathInType");
     817              : 
     818            0 :   begin_field ("path_type");
     819            0 :   do_qualifiedpathtype (e.get_path_type ());
     820            0 :   end_field ("path_type");
     821              : 
     822            0 :   begin_field ("associated_segment");
     823            0 :   do_typepathsegment (e.get_associated_segment ());
     824            0 :   end_field ("associated_segment");
     825              : 
     826            0 :   visit_collection ("segments", e.get_segments ());
     827              : 
     828            0 :   end ("QualifiedPathInType");
     829            0 : }
     830              : 
     831              : void
     832            0 : Dump::visit (LiteralExpr &e)
     833              : {
     834            0 :   begin ("LiteralExpr");
     835            0 :   do_expr (e);
     836            0 :   put_field ("literal", e.get_literal ().as_string ());
     837            0 :   end ("LiteralExpr");
     838            0 : }
     839              : 
     840              : void
     841            0 : Dump::visit (BorrowExpr &e)
     842              : {
     843            0 :   begin ("BorrowExpr");
     844            0 :   do_operatorexpr (e);
     845              : 
     846            0 :   put_field ("mut", enum_to_str (e.get_mut ()));
     847              : 
     848            0 :   end ("BorrowExpr");
     849            0 : }
     850              : 
     851              : void
     852            0 : Dump::visit (DereferenceExpr &e)
     853              : {
     854            0 :   begin ("DereferenceExpr");
     855            0 :   do_operatorexpr (e);
     856            0 :   end ("DereferenceExpr");
     857            0 : }
     858              : 
     859              : void
     860            0 : Dump::visit (ErrorPropagationExpr &e)
     861              : {
     862            0 :   begin ("ErrorPropagationExpr");
     863            0 :   do_operatorexpr (e);
     864            0 :   end ("ErrorPropagationExpr");
     865            0 : }
     866              : 
     867              : void
     868            0 : Dump::visit (NegationExpr &e)
     869              : {
     870            0 :   begin ("NegationExpr");
     871            0 :   do_operatorexpr (e);
     872            0 :   std::string str;
     873            0 :   switch (e.get_expr_type ())
     874              :     {
     875            0 :     case NegationOperator::NEGATE:
     876            0 :       str = "[NEGATE]";
     877            0 :       break;
     878            0 :     case NegationOperator::NOT:
     879            0 :       str = "[NOT]";
     880            0 :       break;
     881            0 :     default:
     882            0 :       rust_assert (false);
     883              :     }
     884            0 :   put_field ("expr_type", str);
     885              : 
     886            0 :   end ("NegationExpr");
     887            0 : }
     888              : 
     889              : void
     890            0 : Dump::visit (ArithmeticOrLogicalExpr &e)
     891              : {
     892            0 :   begin ("ArithmeticOrLogicalExpr");
     893            0 :   std::string str;
     894              : 
     895              :   // which operator
     896            0 :   switch (e.get_expr_type ())
     897              :     {
     898            0 :     case ArithmeticOrLogicalOperator::ADD:
     899            0 :       str = "[ADD]";
     900            0 :       break;
     901            0 :     case ArithmeticOrLogicalOperator::SUBTRACT:
     902            0 :       str = "SUBTRACT";
     903            0 :       break;
     904            0 :     case ArithmeticOrLogicalOperator::MULTIPLY:
     905            0 :       str = "MULTIPLY";
     906            0 :       break;
     907            0 :     case ArithmeticOrLogicalOperator::DIVIDE:
     908            0 :       str = "DIVIDE";
     909            0 :       break;
     910            0 :     case ArithmeticOrLogicalOperator::MODULUS:
     911            0 :       str = "MODULUS";
     912            0 :       break;
     913            0 :     case ArithmeticOrLogicalOperator::BITWISE_AND:
     914            0 :       str = "BITWISE";
     915            0 :       break;
     916            0 :     case ArithmeticOrLogicalOperator::BITWISE_OR:
     917            0 :       str = "BITWISE";
     918            0 :       break;
     919            0 :     case ArithmeticOrLogicalOperator::BITWISE_XOR:
     920            0 :       str = "BITWISE";
     921            0 :       break;
     922            0 :     case ArithmeticOrLogicalOperator::LEFT_SHIFT:
     923            0 :       str = "<LEFT";
     924            0 :       break;
     925            0 :     case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
     926            0 :       str = ">RIGHT";
     927            0 :       break;
     928            0 :     default:
     929            0 :       rust_unreachable ();
     930            0 :       break;
     931              :     }
     932            0 :   put_field ("expr_type", str);
     933            0 :   do_operatorexpr (e);
     934            0 :   visit_field ("right_expr", e.get_rhs ());
     935              : 
     936            0 :   end ("ArithmeticOrLogicalExpr");
     937            0 : }
     938              : 
     939              : void
     940            0 : Dump::visit (ComparisonExpr &e)
     941              : {
     942            0 :   begin ("ComparisonExpr");
     943            0 :   std::string str;
     944            0 :   switch (e.get_expr_type ())
     945              :     {
     946            0 :     case ComparisonOperator::EQUAL:
     947            0 :       str = "EQUAL";
     948            0 :       break;
     949            0 :     case ComparisonOperator::NOT_EQUAL:
     950            0 :       str = "NOT_EQUAL";
     951            0 :       break;
     952            0 :     case ComparisonOperator::GREATER_THAN:
     953            0 :       str = "GREATER_THAN";
     954            0 :       break;
     955            0 :     case ComparisonOperator::LESS_THAN:
     956            0 :       str = "LESS_THAN";
     957            0 :       break;
     958            0 :     case ComparisonOperator::GREATER_OR_EQUAL:
     959            0 :       str = "GREATER_OR_EQUAL";
     960            0 :       break;
     961            0 :     case ComparisonOperator::LESS_OR_EQUAL:
     962            0 :       str = "LESS_OR_EQUAL";
     963            0 :       break;
     964            0 :     default:
     965            0 :       rust_assert (false);
     966              :     }
     967            0 :   put_field ("expr_type", str);
     968            0 :   do_operatorexpr (e);
     969            0 :   visit_field ("right_expr", e.get_rhs ());
     970            0 :   end ("ComparisonExpr");
     971            0 : }
     972              : 
     973              : void
     974            0 : Dump::visit (LazyBooleanExpr &e)
     975              : {
     976            0 :   begin ("LazyBooleanExpr");
     977              : 
     978            0 :   std::string str;
     979            0 :   switch (e.get_expr_type ())
     980              :     {
     981            0 :     case LazyBooleanOperator::LOGICAL_OR:
     982            0 :       str = "LOGICAL_OR";
     983            0 :       break;
     984            0 :     case LazyBooleanOperator::LOGICAL_AND:
     985            0 :       str = "LOGICAL_AND";
     986            0 :       break;
     987            0 :     default:
     988            0 :       rust_assert (false);
     989              :     }
     990              : 
     991            0 :   do_operatorexpr (e);
     992            0 :   visit_field ("right_expr", e.get_rhs ());
     993            0 :   end ("LazyBooleanExpr");
     994            0 : }
     995              : 
     996              : void
     997            0 : Dump::visit (TypeCastExpr &e)
     998              : {
     999            0 :   begin ("TypeCastExpr");
    1000            0 :   do_operatorexpr (e);
    1001            0 :   visit_field ("type_to_convert_to", e.get_type_to_convert_to ());
    1002            0 :   end ("TypeCastExpr");
    1003            0 : }
    1004              : 
    1005              : void
    1006            0 : Dump::visit (AssignmentExpr &e)
    1007              : {
    1008            0 :   begin ("AssignmentExpr");
    1009            0 :   do_operatorexpr (e);
    1010            0 :   visit_field ("right_expr", e.get_rhs ());
    1011            0 :   end ("AssignmentExpr");
    1012            0 : }
    1013              : 
    1014              : void
    1015            0 : Dump::visit (CompoundAssignmentExpr &e)
    1016              : {
    1017            0 :   begin ("CompoundAssignmentExpr");
    1018              : 
    1019            0 :   do_operatorexpr (e);
    1020            0 :   visit_field ("right_expr", e.get_rhs ());
    1021              : 
    1022            0 :   std::string str;
    1023              : 
    1024              :   // get operator string
    1025            0 :   switch (e.get_expr_type ())
    1026              :     {
    1027            0 :     case ArithmeticOrLogicalOperator::ADD:
    1028            0 :       str = "ADD";
    1029            0 :       break;
    1030            0 :     case ArithmeticOrLogicalOperator::SUBTRACT:
    1031            0 :       str = "SUBTRACT";
    1032            0 :       break;
    1033            0 :     case ArithmeticOrLogicalOperator::MULTIPLY:
    1034            0 :       str = "MULTIPLY";
    1035            0 :       break;
    1036            0 :     case ArithmeticOrLogicalOperator::DIVIDE:
    1037            0 :       str = "DIVIDE";
    1038            0 :       break;
    1039            0 :     case ArithmeticOrLogicalOperator::MODULUS:
    1040            0 :       str = "MODULUS";
    1041            0 :       break;
    1042            0 :     case ArithmeticOrLogicalOperator::BITWISE_AND:
    1043            0 :       str = "BITWISE_AND";
    1044            0 :       break;
    1045            0 :     case ArithmeticOrLogicalOperator::BITWISE_OR:
    1046            0 :       str = "BITWISE_OR";
    1047            0 :       break;
    1048            0 :     case ArithmeticOrLogicalOperator::BITWISE_XOR:
    1049            0 :       str = "BITWISE_XOR";
    1050            0 :       break;
    1051            0 :     case ArithmeticOrLogicalOperator::LEFT_SHIFT:
    1052            0 :       str = "LEFT_SHIFT";
    1053            0 :       break;
    1054            0 :     case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
    1055            0 :       str = "RIGHT_SHIFT";
    1056            0 :       break;
    1057            0 :     default:
    1058            0 :       gcc_unreachable ();
    1059            0 :       break;
    1060              :     }
    1061            0 :   put_field ("expr_type", str);
    1062            0 :   end ("CompoundAssignmentExpr");
    1063            0 : }
    1064              : 
    1065              : void
    1066            0 : Dump::visit (GroupedExpr &e)
    1067              : {
    1068            0 :   begin ("GroupedExpr");
    1069            0 :   do_expr (e);
    1070            0 :   do_inner_attrs (e);
    1071              : 
    1072            0 :   visit_field ("expr_in_parens", e.get_expr_in_parens ());
    1073              : 
    1074            0 :   end ("GroupedExpr");
    1075            0 : }
    1076              : 
    1077              : void
    1078            0 : Dump::visit (ArrayElemsValues &e)
    1079              : {
    1080            0 :   begin ("ArrayElemsValues");
    1081            0 :   do_mappings (e.get_mappings ());
    1082              : 
    1083            0 :   visit_collection ("values", e.get_values ());
    1084            0 :   end ("ArrayElemsValues");
    1085            0 : }
    1086              : 
    1087              : void
    1088            0 : Dump::visit (ArrayElemsCopied &e)
    1089              : {
    1090            0 :   begin ("ArrayElemsCopied");
    1091            0 :   do_mappings (e.get_mappings ());
    1092              : 
    1093            0 :   visit_field ("copied_elem", e.get_elem_to_copy ());
    1094            0 :   visit_field ("num_copies", e.get_num_copies_expr ());
    1095              : 
    1096            0 :   end ("ArrayElemsCopied");
    1097            0 : }
    1098              : 
    1099              : void
    1100            0 : Dump::visit (ArrayExpr &e)
    1101              : {
    1102            0 :   begin ("ArrayExpr");
    1103            0 :   do_expr (e);
    1104            0 :   do_inner_attrs (e);
    1105              : 
    1106            0 :   visit_field ("internal_elements", e.get_internal_elements ());
    1107              : 
    1108            0 :   end ("ArrayExpr");
    1109            0 : }
    1110              : 
    1111              : void
    1112            0 : Dump::visit (ArrayIndexExpr &e)
    1113              : {
    1114            0 :   begin ("ArrayIndexExpr");
    1115            0 :   do_expr (e);
    1116              : 
    1117            0 :   visit_field ("array_expr", e.get_array_expr ());
    1118            0 :   visit_field ("index_expr", e.get_index_expr ());
    1119            0 :   end ("ArrayIndexExpr");
    1120            0 : }
    1121              : 
    1122              : void
    1123            0 : Dump::visit (TupleExpr &e)
    1124              : {
    1125            0 :   begin ("TupleExpr");
    1126            0 :   do_expr (e);
    1127            0 :   do_inner_attrs (e);
    1128              : 
    1129            0 :   visit_collection ("tuple_elems", e.get_tuple_elems ());
    1130              : 
    1131            0 :   end ("TupleExpr");
    1132            0 : }
    1133              : 
    1134              : void
    1135            0 : Dump::visit (TupleIndexExpr &e)
    1136              : {
    1137            0 :   begin ("TupleIndexExpr");
    1138            0 :   do_expr (e);
    1139            0 :   visit_field ("tuple_expr", e.get_tuple_expr ());
    1140            0 :   put_field ("tuple_index", std::to_string (e.get_tuple_index ()));
    1141            0 :   end ("TupleIndexExpr");
    1142            0 : }
    1143              : 
    1144              : void
    1145            0 : Dump::visit (StructExprStruct &e)
    1146              : {
    1147            0 :   begin ("StructExprStruct");
    1148            0 :   do_structexprstruct (e);
    1149            0 :   end ("StructExprStruct");
    1150            0 : }
    1151              : 
    1152              : void
    1153            0 : Dump::visit (StructExprFieldIdentifier &e)
    1154              : {
    1155            0 :   begin ("StructExprFieldIdentifier");
    1156            0 :   do_mappings (e.get_mappings ());
    1157              : 
    1158            0 :   put_field ("field_name", e.get_field_name ().as_string ());
    1159            0 :   end ("StructExprFieldIdentifier");
    1160            0 : }
    1161              : 
    1162              : void
    1163            0 : Dump::visit (StructExprFieldIdentifierValue &e)
    1164              : {
    1165            0 :   begin ("StructExprFieldIdentifierValue");
    1166            0 :   do_mappings (e.get_mappings ());
    1167              : 
    1168            0 :   visit_field ("value", e.get_value ());
    1169            0 :   end ("StructExprFieldIdentifierValue");
    1170            0 : }
    1171              : 
    1172              : void
    1173            0 : Dump::visit (StructExprFieldIndexValue &e)
    1174              : {
    1175            0 :   begin ("StructExprFieldIndexValue");
    1176            0 :   do_mappings (e.get_mappings ());
    1177              : 
    1178            0 :   put_field ("index", std::to_string (e.get_tuple_index ()));
    1179            0 :   visit_field ("value", e.get_value ());
    1180            0 :   end ("StructExprFieldIndexValue");
    1181            0 : }
    1182              : 
    1183              : void
    1184            0 : Dump::visit (StructExprStructFields &e)
    1185              : {
    1186            0 :   begin ("StructExprStructFields");
    1187            0 :   do_structexprstruct (e);
    1188              : 
    1189            0 :   visit_collection ("fields", e.get_fields ());
    1190              : 
    1191            0 :   if (!e.has_struct_base ())
    1192            0 :     put_field ("struct_base", "none");
    1193              :   else
    1194            0 :     put_field ("struct_base", e.get_struct_base ().to_string ());
    1195              : 
    1196            0 :   end ("StructExprStructFields");
    1197            0 : }
    1198              : 
    1199              : void
    1200            0 : Dump::visit (StructExprStructBase &e)
    1201              : {
    1202            0 :   begin ("StructExprStructBase");
    1203            0 :   do_structexprstruct (e);
    1204              : 
    1205            0 :   put_field ("struct_base", e.get_struct_base ().to_string ());
    1206              : 
    1207            0 :   end ("StructExprStructBase");
    1208            0 : }
    1209              : 
    1210              : void
    1211            0 : Dump::visit (CallExpr &e)
    1212              : {
    1213            0 :   begin ("CallExpr");
    1214            0 :   do_expr (e);
    1215            0 :   visit_field ("function", e.get_fnexpr ());
    1216              : 
    1217            0 :   visit_collection ("params", e.get_arguments ());
    1218              : 
    1219            0 :   end ("CallExpr");
    1220            0 : }
    1221              : 
    1222              : void
    1223            0 : Dump::visit (MethodCallExpr &e)
    1224              : {
    1225            0 :   begin ("MethodCallExpr");
    1226            0 :   do_expr (e);
    1227              : 
    1228            0 :   visit_field ("receiver", e.get_receiver ());
    1229            0 :   put_field ("method_name", e.get_method_name ().to_string ());
    1230            0 :   visit_collection ("params", e.get_arguments ());
    1231              : 
    1232            0 :   end ("MethodCallExpr");
    1233            0 : }
    1234              : 
    1235              : void
    1236            0 : Dump::visit (FieldAccessExpr &e)
    1237              : {
    1238            0 :   begin ("FieldAccessExpr");
    1239            0 :   do_expr (e);
    1240            0 :   visit_field ("receiver", e.get_receiver_expr ());
    1241            0 :   put_field ("field", e.get_field_name ().as_string ());
    1242            0 :   end ("FieldAccessExpr");
    1243            0 : }
    1244              : 
    1245              : void
    1246            0 : Dump::visit (ClosureExpr &e)
    1247              : {
    1248            0 :   begin ("ClosureExpr");
    1249            0 :   do_expr (e);
    1250              : 
    1251            0 :   if (!e.has_params ())
    1252              :     {
    1253            0 :       put_field ("params", "none");
    1254              :     }
    1255              :   else
    1256              :     {
    1257            0 :       begin_field ("params");
    1258            0 :       for (auto &param : e.get_params ())
    1259              :         {
    1260            0 :           begin ("ClosureParam");
    1261            0 :           auto oa = param.get_outer_attrs ();
    1262            0 :           do_outer_attrs (oa);
    1263            0 :           visit_field ("pattern", param.get_pattern ());
    1264              : 
    1265            0 :           if (param.has_type_given ())
    1266            0 :             visit_field ("type", param.get_type ());
    1267              : 
    1268            0 :           end ("ClosureParam");
    1269            0 :         }
    1270            0 :       end_field ("params");
    1271              :     }
    1272              : 
    1273            0 :   if (e.has_return_type ())
    1274            0 :     visit_field ("return_type", e.get_return_type ());
    1275              : 
    1276            0 :   visit_field ("expr", e.get_expr ());
    1277            0 :   end ("ClosureExpr");
    1278            0 : }
    1279              : 
    1280              : void
    1281            0 : Dump::visit (BlockExpr &e)
    1282              : {
    1283            0 :   begin ("BlockExpr");
    1284            0 :   do_expr (e);
    1285            0 :   do_inner_attrs (e);
    1286            0 :   put_field ("tail_reachable", std::to_string (e.is_tail_reachable ()));
    1287              : 
    1288            0 :   if (e.has_label ())
    1289            0 :     put_field ("label", e.get_label ().to_string ());
    1290              : 
    1291            0 :   visit_collection ("statements", e.get_statements ());
    1292              : 
    1293            0 :   if (e.has_final_expr ())
    1294            0 :     visit_field ("expr", e.get_final_expr ());
    1295              : 
    1296            0 :   end ("BlockExpr");
    1297            0 : }
    1298              : 
    1299              : void
    1300            0 : Dump::visit (AnonConst &e)
    1301              : {
    1302            0 :   begin ("AnonConst");
    1303            0 :   do_expr (e);
    1304              : 
    1305            0 :   if (e.is_deferred ())
    1306            0 :     put_field ("inner", "_");
    1307              :   else
    1308            0 :     visit_field ("inner", e.get_inner_expr ());
    1309              : 
    1310            0 :   end ("AnonConst");
    1311            0 : }
    1312              : 
    1313              : void
    1314            0 : Dump::visit (ConstBlock &e)
    1315              : {
    1316            0 :   begin ("ConstBlock");
    1317            0 :   do_expr (e);
    1318              : 
    1319            0 :   visit_field ("inner", e.get_const_expr ());
    1320              : 
    1321            0 :   end ("ConstBlock");
    1322            0 : }
    1323              : 
    1324              : void
    1325            0 : Dump::visit (ContinueExpr &e)
    1326              : {
    1327            0 :   begin ("ContinueExpr");
    1328              : 
    1329            0 :   if (e.has_label ())
    1330            0 :     put_field ("label", e.get_label ().to_string ());
    1331              :   else
    1332            0 :     put_field ("label", "none");
    1333              : 
    1334            0 :   end ("ContinueExpr");
    1335            0 : }
    1336              : 
    1337              : void
    1338            0 : Dump::visit (BreakExpr &e)
    1339              : {
    1340            0 :   begin ("BreakExpr");
    1341            0 :   std::string str ("break ");
    1342              : 
    1343            0 :   if (e.has_label ())
    1344            0 :     put_field ("label", e.get_label ().to_string ());
    1345              :   else
    1346            0 :     put_field ("label", "none");
    1347              : 
    1348            0 :   if (e.has_break_expr ())
    1349            0 :     visit_field ("break_expr ", e.get_expr ());
    1350              :   else
    1351            0 :     put_field ("break_expr", "none");
    1352              : 
    1353            0 :   end ("BreakExpr");
    1354            0 : }
    1355              : 
    1356              : void
    1357            0 : Dump::visit (RangeFromToExpr &e)
    1358              : {
    1359            0 :   begin ("RangeFromToExpr");
    1360              : 
    1361            0 :   visit_field ("from", e.get_from_expr ());
    1362            0 :   visit_field ("to", e.get_to_expr ());
    1363              : 
    1364            0 :   end ("RangeFromToExpr");
    1365            0 : }
    1366              : 
    1367              : void
    1368            0 : Dump::visit (RangeFromExpr &e)
    1369              : {
    1370            0 :   begin ("RangeFromExpr");
    1371              : 
    1372            0 :   visit_field ("from", e.get_from_expr ());
    1373              : 
    1374            0 :   end ("RangeFromExpr");
    1375            0 : }
    1376              : 
    1377              : void
    1378            0 : Dump::visit (RangeToExpr &e)
    1379              : {
    1380            0 :   begin ("RangeToExpr");
    1381              : 
    1382            0 :   visit_field ("to", e.get_to_expr ());
    1383              : 
    1384            0 :   end ("RangeToExpr");
    1385            0 : }
    1386              : 
    1387              : void
    1388            0 : Dump::visit (RangeFullExpr &e)
    1389              : {
    1390            0 :   begin ("RangeFullExpr");
    1391            0 :   end ("RangeFullExpr");
    1392            0 : }
    1393              : 
    1394              : void
    1395            0 : Dump::visit (RangeFromToInclExpr &e)
    1396              : {
    1397            0 :   begin ("RangeFromToInclExpr");
    1398              : 
    1399            0 :   visit_field ("from", e.get_from_expr ());
    1400            0 :   visit_field ("to", e.get_to_expr ());
    1401              : 
    1402            0 :   end ("RangeFromToInclExpr");
    1403            0 : }
    1404              : 
    1405              : void
    1406            0 : Dump::visit (RangeToInclExpr &e)
    1407              : {
    1408            0 :   begin ("RangeToInclExpr");
    1409              : 
    1410            0 :   visit_field ("to", e.get_to_expr ());
    1411              : 
    1412            0 :   end ("RangeToInclExpr");
    1413            0 : }
    1414              : 
    1415              : void
    1416            0 : Dump::visit (ReturnExpr &e)
    1417              : {
    1418            0 :   begin ("ReturnExpr");
    1419            0 :   do_mappings (e.get_mappings ());
    1420              : 
    1421            0 :   if (e.has_return_expr ())
    1422            0 :     visit_field ("return_expr", e.get_expr ());
    1423              : 
    1424            0 :   end ("ReturnExpr");
    1425            0 : }
    1426              : 
    1427              : void
    1428            0 : Dump::visit (UnsafeBlockExpr &e)
    1429              : {
    1430            0 :   begin ("UnsafeBlockExpr");
    1431            0 :   auto oa = e.get_outer_attrs ();
    1432            0 :   do_outer_attrs (oa);
    1433              : 
    1434            0 :   visit_field ("block_expr", e.get_block_expr ());
    1435              : 
    1436            0 :   end ("UnsafeBlockExpr");
    1437            0 : }
    1438              : 
    1439              : void
    1440            0 : Dump::visit (LoopExpr &e)
    1441              : {
    1442            0 :   begin ("LoopExpr");
    1443            0 :   do_baseloopexpr (e);
    1444            0 :   end ("LoopExpr");
    1445            0 : }
    1446              : 
    1447              : void
    1448            0 : Dump::visit (WhileLoopExpr &e)
    1449              : {
    1450            0 :   begin ("WhileLoopExpr");
    1451            0 :   do_baseloopexpr (e);
    1452              : 
    1453            0 :   visit_field ("condition", e.get_predicate_expr ());
    1454              : 
    1455            0 :   end ("WhileLoopExpr");
    1456            0 : }
    1457              : 
    1458              : void
    1459            0 : Dump::visit (WhileLetLoopExpr &e)
    1460              : {
    1461            0 :   begin ("WhileLetLoopExpr");
    1462            0 :   do_baseloopexpr (e);
    1463              : 
    1464            0 :   visit_field ("match_arm_patterns", e.get_pattern ());
    1465              : 
    1466            0 :   visit_field ("condition", e.get_cond ());
    1467              : 
    1468            0 :   end ("WhileLetLoopExpr");
    1469            0 : }
    1470              : 
    1471              : void
    1472            0 : Dump::visit (IfExpr &e)
    1473              : {
    1474            0 :   begin ("IfExpr");
    1475            0 :   do_ifexpr (e);
    1476            0 :   end ("IfExpr");
    1477            0 : }
    1478              : 
    1479              : void
    1480            0 : Dump::visit (IfExprConseqElse &e)
    1481              : {
    1482            0 :   begin ("IfExprConseqElse");
    1483            0 :   do_ifexpr (e);
    1484            0 :   visit_field ("else_block", e.get_else_block ());
    1485              : 
    1486            0 :   end ("IfExprConseqElse");
    1487            0 : }
    1488              : 
    1489              : void
    1490            0 : Dump::visit (MatchExpr &e)
    1491              : {
    1492            0 :   begin ("MatchExpr");
    1493            0 :   do_inner_attrs (e);
    1494            0 :   do_expr (e);
    1495              : 
    1496            0 :   visit_field ("branch_value", e.get_scrutinee_expr ());
    1497              : 
    1498            0 :   if (!e.has_match_arms ())
    1499              :     {
    1500            0 :       put_field ("match_arms", "empty");
    1501              :     }
    1502              :   else
    1503              :     {
    1504            0 :       begin_field ("match_arms");
    1505            0 :       for (auto &arm : e.get_match_cases ())
    1506            0 :         do_matchcase (arm);
    1507            0 :       end_field ("match_arms");
    1508              :     }
    1509            0 :   end ("MatchExpr");
    1510            0 : }
    1511              : 
    1512              : void
    1513            0 : Dump::visit (AwaitExpr &e)
    1514              : {
    1515            0 :   begin ("AwaitExpr");
    1516            0 :   do_expr (e);
    1517            0 :   visit_field ("awaited_expr", e.get_awaited_expr ());
    1518            0 :   end ("AwaitExpr");
    1519            0 : }
    1520              : 
    1521              : void
    1522            0 : Dump::visit (AsyncBlockExpr &e)
    1523              : {
    1524            0 :   begin ("AsyncBlockExpr");
    1525            0 :   do_expr (e);
    1526              : 
    1527            0 :   put_field ("has move", std::to_string (e.get_has_move ()));
    1528            0 :   visit_field ("block_expr", e.get_block_expr ());
    1529              : 
    1530            0 :   end ("AsyncBlockExpr");
    1531            0 : }
    1532              : 
    1533              : void
    1534            0 : Dump::visit (InlineAsm &e)
    1535              : {
    1536            0 :   begin ("InlineAsm");
    1537            0 :   do_expr (e);
    1538            0 :   for (auto &temp : e.get_template_ ())
    1539              :     {
    1540            0 :       put_field ("template", temp.string);
    1541            0 :     }
    1542              : 
    1543            0 :   for (auto &temp_str : e.get_template_strs ())
    1544              :     {
    1545            0 :       put_field ("template_str", temp_str.symbol);
    1546            0 :     }
    1547              : 
    1548            0 :   for (auto &operand : e.get_operands ())
    1549              :     {
    1550            0 :       switch (operand.get_register_type ())
    1551              :         {
    1552            0 :         case HIR::InlineAsmOperand::RegisterType::In:
    1553            0 :           {
    1554            0 :             const auto &in = operand.get_in ();
    1555            0 :             visit_field ("in expr", *in.expr);
    1556            0 :             break;
    1557              :           }
    1558            0 :         case HIR::InlineAsmOperand::RegisterType::Out:
    1559            0 :           {
    1560            0 :             const auto &out = operand.get_out ();
    1561            0 :             visit_field ("out expr", *out.expr);
    1562            0 :             break;
    1563              :           }
    1564            0 :         case HIR::InlineAsmOperand::RegisterType::InOut:
    1565            0 :           {
    1566            0 :             const auto &inout = operand.get_in_out ();
    1567            0 :             visit_field ("inout expr", *inout.expr);
    1568            0 :             break;
    1569              :           }
    1570            0 :         case HIR::InlineAsmOperand::RegisterType::SplitInOut:
    1571            0 :           {
    1572            0 :             const auto &inout = operand.get_split_in_out ();
    1573            0 :             begin ("Split in out");
    1574            0 :             visit_field ("in expr", *inout.in_expr);
    1575            0 :             visit_field ("out expr", *inout.out_expr);
    1576            0 :             end ("Split in out");
    1577              : 
    1578            0 :             break;
    1579              :           }
    1580            0 :         case HIR::InlineAsmOperand::RegisterType::Const:
    1581            0 :           {
    1582            0 :             auto &cnst = operand.get_const ();
    1583            0 :             visit_field ("const expr", cnst.anon_const.get_inner_expr ());
    1584            0 :             break;
    1585              :           }
    1586            0 :         case HIR::InlineAsmOperand::RegisterType::Sym:
    1587            0 :           {
    1588            0 :             auto &sym = operand.get_sym ();
    1589            0 :             visit_field ("sym expr", *sym.expr);
    1590            0 :             break;
    1591              :           }
    1592            0 :         case HIR::InlineAsmOperand::RegisterType::Label:
    1593            0 :           {
    1594            0 :             auto &label = operand.get_label ();
    1595            0 :             put_field ("label name", label.label_name);
    1596            0 :             do_expr (*label.expr);
    1597            0 :             break;
    1598              :           }
    1599              :         }
    1600              :     }
    1601            0 :   end ("InlineAsm");
    1602            0 : }
    1603              : 
    1604              : void
    1605            0 : Dump::visit (LlvmInlineAsm &e)
    1606            0 : {}
    1607              : 
    1608              : void
    1609            0 : Dump::visit (OffsetOf &e)
    1610              : {
    1611            0 :   begin ("OffsetOf");
    1612              : 
    1613            0 :   put_field ("type", e.get_type ().to_debug_string ());
    1614            0 :   put_field ("field", e.get_field ());
    1615              : 
    1616            0 :   end ("OffsetOf");
    1617            0 : }
    1618              : 
    1619              : void
    1620            0 : Dump::visit (TypeParam &e)
    1621              : {
    1622            0 :   begin ("TypeParam");
    1623            0 :   auto &outer_attrs = e.get_outer_attrs ();
    1624            0 :   do_outer_attrs (outer_attrs);
    1625              : 
    1626            0 :   put_field ("type_representation", e.get_type_representation ().as_string ());
    1627              : 
    1628            0 :   visit_collection ("type_param_bounds", e.get_type_param_bounds ());
    1629              : 
    1630            0 :   if (e.has_type ())
    1631            0 :     visit_field ("type", e.get_type ());
    1632              : 
    1633            0 :   end ("TypeParam");
    1634            0 : }
    1635              : 
    1636              : void
    1637            0 : Dump::visit (ConstGenericParam &e)
    1638              : {
    1639            0 :   begin ("ConstGenericParam");
    1640            0 :   do_mappings (e.get_mappings ());
    1641            0 :   put_field ("name", e.get_name ());
    1642            0 :   visit_field ("type", e.get_type ());
    1643            0 :   visit_field ("default_expression", e.get_default_expression ());
    1644            0 :   end ("ConstGenericParam");
    1645            0 : }
    1646              : 
    1647              : void
    1648            0 : Dump::visit (LifetimeWhereClauseItem &e)
    1649              : {
    1650            0 :   begin ("LifetimeWhereClauseItem");
    1651            0 :   do_mappings (e.get_mappings ());
    1652              : 
    1653            0 :   visit_field ("lifetime", e.get_lifetime ());
    1654            0 :   visit_collection ("lifetime_bounds", e.get_lifetime_bounds ());
    1655              : 
    1656            0 :   end ("LifetimeWhereClauseItem");
    1657            0 : }
    1658              : 
    1659              : void
    1660            0 : Dump::visit (TypeBoundWhereClauseItem &e)
    1661              : {
    1662            0 :   begin ("TypeBoundWhereClauseItem");
    1663            0 :   do_mappings (e.get_mappings ());
    1664              : 
    1665            0 :   visit_collection ("for_lifetime", e.get_for_lifetimes ());
    1666              : 
    1667            0 :   visit_field ("bound_type", e.get_bound_type ());
    1668            0 :   visit_collection ("type_param_bound", e.get_type_param_bounds ());
    1669            0 :   end ("TypeBoundWhereClauseItem");
    1670            0 : }
    1671              : 
    1672              : void
    1673            0 : Dump::visit (Module &e)
    1674              : {
    1675            0 :   begin ("Module");
    1676            0 :   do_inner_attrs (e);
    1677            0 :   put_field ("module_name", e.get_module_name ().as_string ());
    1678            0 :   visit_collection ("items", e.get_items ());
    1679              : 
    1680            0 :   end ("Module");
    1681            0 : }
    1682              : 
    1683              : void
    1684            0 : Dump::visit (ExternCrate &e)
    1685              : {
    1686            0 :   begin ("ExternCrate");
    1687            0 :   do_vis_item (e);
    1688            0 :   put_field ("referenced_crate", e.get_referenced_crate ());
    1689            0 :   put_field ("as_clause_name", e.get_as_clause_name ());
    1690              : 
    1691            0 :   end ("ExternCrate");
    1692            0 : }
    1693              : 
    1694              : void
    1695            0 : Dump::visit (UseTreeGlob &e)
    1696              : {
    1697            0 :   begin ("UseTreeGlob");
    1698              : 
    1699            0 :   std::string glob, path = "not applicable";
    1700            0 :   switch (e.get_glob_type ())
    1701              :     {
    1702            0 :     case UseTreeGlob::PathType::NO_PATH:
    1703            0 :       glob = "*";
    1704            0 :       break;
    1705            0 :     case UseTreeGlob::PathType::GLOBAL:
    1706            0 :       glob = "::*";
    1707            0 :       break;
    1708            0 :     case UseTreeGlob::PathType::PATH_PREFIXED:
    1709            0 :       {
    1710            0 :         path = e.get_path ().as_string ();
    1711            0 :         glob = "::*";
    1712            0 :         break;
    1713              :       }
    1714            0 :     default:
    1715            0 :       gcc_unreachable ();
    1716              :     }
    1717            0 :   put_field ("glob", glob);
    1718            0 :   put_field ("path", path);
    1719              : 
    1720            0 :   end ("UseTreeGlob");
    1721            0 : }
    1722              : 
    1723              : void
    1724            0 : Dump::visit (UseTreeList &e)
    1725              : {
    1726            0 :   begin ("UseTreeList");
    1727              : 
    1728            0 :   std::string path_type, path = "not applicable";
    1729            0 :   switch (e.get_path_type ())
    1730              :     {
    1731            0 :     case UseTreeList::PathType::NO_PATH:
    1732            0 :       path_type = "*";
    1733            0 :       break;
    1734            0 :     case UseTreeList::PathType::GLOBAL:
    1735            0 :       path_type = "::*";
    1736            0 :       break;
    1737            0 :     case UseTreeList::PathType::PATH_PREFIXED:
    1738            0 :       {
    1739            0 :         path = e.get_path ().as_string ();
    1740            0 :         path_type = "::*";
    1741            0 :         break;
    1742              :       }
    1743            0 :     default:
    1744            0 :       gcc_unreachable ();
    1745              :     }
    1746            0 :   put_field ("path_type", path_type);
    1747            0 :   put_field ("path", path);
    1748              : 
    1749            0 :   visit_collection ("trees", e.get_trees ());
    1750              : 
    1751            0 :   end ("UseTreeList");
    1752            0 : }
    1753              : 
    1754              : void
    1755            0 : Dump::visit (UseTreeRebind &e)
    1756              : {
    1757            0 :   begin ("UseTreeRebind");
    1758            0 :   put_field ("path", e.get_path ().as_string ());
    1759            0 :   put_field ("identifier", e.get_identifier ().as_string ());
    1760            0 :   put_field ("bind_type", enum_to_str (e.get_bind_type ()));
    1761            0 :   end ("UseTreeRebind");
    1762            0 : }
    1763              : 
    1764              : void
    1765            0 : Dump::visit (UseDeclaration &e)
    1766              : {
    1767            0 :   begin ("UseDeclaration");
    1768            0 :   do_vis_item (e);
    1769              : 
    1770            0 :   visit_field ("use_tree", e.get_use_tree ());
    1771              : 
    1772            0 :   end ("UseDeclaration");
    1773            0 : }
    1774              : 
    1775              : void
    1776            0 : Dump::visit (Function &e)
    1777              : {
    1778            0 :   begin ("Function");
    1779            0 :   do_vis_item (e);
    1780              : 
    1781            0 :   put_field ("function_qualifiers", e.get_qualifiers ().to_string ());
    1782              : 
    1783            0 :   visit_collection ("generic_params", e.get_generic_params ());
    1784              : 
    1785            0 :   put_field ("function_name", e.get_function_name ().as_string ());
    1786              : 
    1787            0 :   if (e.has_function_params ())
    1788              :     {
    1789            0 :       begin_field ("function_params");
    1790            0 :       for (auto &item : e.get_function_params ())
    1791            0 :         do_functionparam (item);
    1792            0 :       end_field ("function_params");
    1793              :     }
    1794              :   else
    1795              :     {
    1796            0 :       put_field ("function_params", "empty");
    1797              :     }
    1798              : 
    1799            0 :   if (e.has_function_return_type ())
    1800            0 :     visit_field ("return_type", e.get_return_type ());
    1801              : 
    1802            0 :   if (!e.has_where_clause ())
    1803            0 :     put_field ("where_clause", "none");
    1804              :   else
    1805            0 :     put_field ("where clause", e.get_where_clause ().to_string ());
    1806              : 
    1807            0 :   visit_field ("function_body", e.get_definition ());
    1808            0 :   if (e.is_method ())
    1809            0 :     put_field ("self", e.get_self_param_unchecked ().to_string ());
    1810              : 
    1811            0 :   end ("Function");
    1812            0 : }
    1813              : 
    1814              : void
    1815            0 : Dump::visit (TypeAlias &e)
    1816              : {
    1817            0 :   begin ("TypeAlias");
    1818              : 
    1819            0 :   do_vis_item (e);
    1820              : 
    1821            0 :   put_field ("new_type_name", e.get_new_type_name ().as_string ());
    1822              : 
    1823            0 :   visit_collection ("generic_params", e.get_generic_params ());
    1824              : 
    1825            0 :   if (!e.has_where_clause ())
    1826            0 :     put_field ("where_clause", "none");
    1827              :   else
    1828            0 :     put_field ("where clause", e.get_where_clause ().to_string ());
    1829              : 
    1830            0 :   put_field ("type", e.get_type_aliased ().to_debug_string ());
    1831              : 
    1832            0 :   end ("TypeAlias");
    1833            0 : }
    1834              : 
    1835              : void
    1836            0 : Dump::visit (StructStruct &e)
    1837              : {
    1838            0 :   begin ("StructStruct");
    1839            0 :   do_struct (e);
    1840              : 
    1841            0 :   put_field ("is_unit", std::to_string (e.is_unit_struct ()));
    1842              : 
    1843            0 :   if (e.get_fields ().empty ())
    1844            0 :     put_field ("fields", "empty");
    1845              :   else
    1846              :     {
    1847            0 :       begin_field ("fields");
    1848            0 :       for (auto &field : e.get_fields ())
    1849              :         {
    1850            0 :           begin ("StructField");
    1851            0 :           do_structfield (field);
    1852            0 :           end ("StructField");
    1853              :         }
    1854            0 :       end_field ("fields");
    1855              :     }
    1856              : 
    1857            0 :   end ("StructStruct");
    1858            0 : }
    1859              : 
    1860              : void
    1861            0 : Dump::visit (TupleStruct &e)
    1862              : {
    1863            0 :   begin ("TupleStruct");
    1864            0 :   do_struct (e);
    1865              : 
    1866            0 :   if (e.get_fields ().empty ())
    1867            0 :     put_field ("fields", "empty");
    1868              :   else
    1869              :     {
    1870            0 :       begin_field ("fields");
    1871            0 :       for (auto &field : e.get_fields ())
    1872              :         {
    1873            0 :           begin ("TupleField");
    1874            0 :           do_tuplefield (field);
    1875            0 :           end ("TupleField");
    1876              :         }
    1877            0 :       end_field ("fields");
    1878              :     }
    1879              : 
    1880            0 :   end ("TupleStruct");
    1881            0 : }
    1882              : 
    1883              : void
    1884            0 : Dump::visit (EnumItem &e)
    1885              : {
    1886            0 :   begin ("EnumItem");
    1887            0 :   do_enumitem (e);
    1888            0 :   end ("EnumItem");
    1889            0 : }
    1890              : 
    1891              : void
    1892            0 : Dump::visit (EnumItemTuple &e)
    1893              : {
    1894            0 :   begin ("EnumItemTuple");
    1895            0 :   do_enumitem (e);
    1896              : 
    1897            0 :   if (e.has_tuple_fields ())
    1898              :     {
    1899            0 :       begin_field ("tuple_fields");
    1900            0 :       for (auto field : e.get_tuple_fields ())
    1901            0 :         do_tuplefield (field);
    1902            0 :       end_field ("tuple_fields");
    1903              :     }
    1904              :   else
    1905            0 :     put_field ("tuple_fields", "empty");
    1906              : 
    1907            0 :   end ("EnumItemTuple");
    1908            0 : }
    1909              : 
    1910              : void
    1911            0 : Dump::visit (EnumItemStruct &e)
    1912              : {
    1913            0 :   begin ("EnumItemStruct");
    1914            0 :   do_enumitem (e);
    1915              : 
    1916            0 :   if (e.has_struct_fields ())
    1917              :     {
    1918            0 :       begin_field ("struct_fields");
    1919            0 :       for (auto field : e.get_struct_fields ())
    1920            0 :         do_structfield (field);
    1921            0 :       end_field ("struct_fields");
    1922              :     }
    1923              :   else
    1924              :     {
    1925            0 :       put_field ("struct_fields", "empty");
    1926              :     }
    1927            0 :   end ("EnumItemStruct");
    1928            0 : }
    1929              : 
    1930              : void
    1931            0 : Dump::visit (EnumItemDiscriminant &e)
    1932              : {
    1933            0 :   begin ("EnumItemDiscriminant");
    1934              : 
    1935            0 :   do_enumitem (e);
    1936              : 
    1937            0 :   visit_field ("discriminant", e.get_discriminant_expression ());
    1938              : 
    1939            0 :   end ("EnumItemDiscriminant");
    1940            0 : }
    1941              : 
    1942              : void
    1943            0 : Dump::visit (Enum &e)
    1944              : {
    1945            0 :   begin ("Enum");
    1946            0 :   do_vis_item (e);
    1947              : 
    1948            0 :   put_field ("enum_name", e.get_identifier ().as_string ());
    1949              : 
    1950            0 :   visit_collection ("generic_params", e.get_generic_params ());
    1951              : 
    1952            0 :   std::string str = "none";
    1953            0 :   if (e.has_where_clause ())
    1954            0 :     str = e.get_where_clause ().to_string ();
    1955            0 :   put_field ("where clause", str);
    1956              : 
    1957            0 :   visit_collection ("items", e.get_variants ());
    1958              : 
    1959            0 :   end ("Enum");
    1960            0 : }
    1961              : 
    1962              : void
    1963            0 : Dump::visit (Union &e)
    1964              : {
    1965            0 :   begin ("Union");
    1966            0 :   do_vis_item (e);
    1967              : 
    1968            0 :   visit_collection ("generic_params", e.get_generic_params ());
    1969              : 
    1970            0 :   std::string str;
    1971            0 :   if (e.has_where_clause ())
    1972            0 :     str = e.get_where_clause ().to_string ();
    1973              :   else
    1974            0 :     str = "none";
    1975            0 :   put_field ("where clause", str);
    1976              : 
    1977            0 :   if (e.get_variants ().empty ())
    1978              :     {
    1979            0 :       put_field ("variants", "empty");
    1980              :     }
    1981              :   else
    1982              :     {
    1983            0 :       begin_field ("variants");
    1984            0 :       for (auto &elt : e.get_variants ())
    1985              :         {
    1986            0 :           begin ("StructField");
    1987            0 :           auto oa = e.get_outer_attrs ();
    1988            0 :           do_outer_attrs (oa);
    1989              : 
    1990            0 :           std::string str = "none";
    1991            0 :           if (elt.has_visibility ())
    1992            0 :             str = elt.get_visibility ().to_string ();
    1993            0 :           put_field ("visibility", str);
    1994            0 :           put_field ("field_name", elt.get_field_name ().as_string ());
    1995            0 :           visit_field ("field_type", elt.get_field_type ());
    1996            0 :           end ("StructField");
    1997            0 :         }
    1998            0 :       end_field ("variants");
    1999              :     }
    2000            0 :   end ("Union");
    2001            0 : }
    2002              : 
    2003              : void
    2004            0 : Dump::visit (ConstantItem &e)
    2005              : {
    2006            0 :   begin ("ConstantItem");
    2007            0 :   do_vis_item (e);
    2008            0 :   put_field ("identifier", e.get_identifier ().as_string ());
    2009            0 :   visit_field ("type", e.get_type ());
    2010            0 :   if (e.has_expr ())
    2011            0 :     visit_field ("const_expr", e.get_expr ());
    2012            0 :   end ("ConstantItem");
    2013            0 : }
    2014              : 
    2015              : void
    2016            0 : Dump::visit (StaticItem &e)
    2017              : {
    2018            0 :   begin ("StaticItem");
    2019            0 :   do_vis_item (e);
    2020            0 :   put_field ("mut", std::to_string (e.is_mut ()));
    2021            0 :   put_field ("name", e.get_identifier ().as_string ());
    2022            0 :   visit_field ("type", e.get_type ());
    2023            0 :   visit_field ("expr", e.get_expr ());
    2024            0 :   end ("StaticItem");
    2025            0 : }
    2026              : 
    2027              : void
    2028            0 : Dump::visit (TraitItemFunc &e)
    2029              : {
    2030            0 :   begin ("TraitItemFunc");
    2031            0 :   do_traititem (e);
    2032              : 
    2033            0 :   do_traitfunctiondecl (e.get_decl ());
    2034              : 
    2035            0 :   if (e.has_definition ())
    2036            0 :     visit_field ("block_expr", e.get_block_expr ());
    2037              : 
    2038            0 :   end ("TraitItemFunc");
    2039            0 : }
    2040              : 
    2041              : void
    2042            0 : Dump::visit (TraitItemConst &e)
    2043              : {
    2044            0 :   begin ("TraitItemConst");
    2045            0 :   do_traititem (e);
    2046              : 
    2047            0 :   put_field ("name", e.get_name ().as_string ());
    2048            0 :   visit_field ("type", e.get_type ());
    2049            0 :   if (e.has_expr ())
    2050            0 :     visit_field ("expr", e.get_expr ());
    2051              : 
    2052            0 :   end ("TraitItemConst");
    2053            0 : }
    2054              : 
    2055              : void
    2056            0 : Dump::visit (TraitItemType &e)
    2057              : {
    2058            0 :   begin ("TraitItemType");
    2059            0 :   do_traititem (e);
    2060              : 
    2061            0 :   put_field ("name", e.get_name ().as_string ());
    2062            0 :   visit_collection ("type_param_bounds", e.get_type_param_bounds ());
    2063            0 :   end ("TraitItemType");
    2064            0 : }
    2065              : 
    2066              : void
    2067            0 : Dump::visit (Trait &e)
    2068              : {
    2069            0 :   begin ("Trait");
    2070            0 :   do_vis_item (e);
    2071            0 :   put_field ("unsafety", std::to_string (e.is_unsafe ()));
    2072            0 :   put_field ("name", e.get_name ().as_string ());
    2073              : 
    2074            0 :   visit_collection ("generic_params", e.get_generic_params ());
    2075              : 
    2076            0 :   visit_collection ("type_param_bounds", e.get_type_param_bounds ());
    2077              : 
    2078            0 :   std::string str;
    2079            0 :   if (e.has_where_clause ())
    2080            0 :     str = e.get_where_clause ().to_string ();
    2081              :   else
    2082            0 :     str = "none";
    2083            0 :   put_field ("where clause", str);
    2084              : 
    2085            0 :   visit_collection ("trait_items", e.get_trait_items ());
    2086              : 
    2087            0 :   end ("Trait");
    2088            0 : }
    2089              : 
    2090              : void
    2091            0 : Dump::visit (ImplBlock &e)
    2092              : {
    2093            0 :   begin ("ImplBlock");
    2094            0 :   do_vis_item (e);
    2095              : 
    2096            0 :   visit_collection ("generic_params", e.get_generic_params ());
    2097              : 
    2098            0 :   visit_field ("impl_type", e.get_type ());
    2099              : 
    2100            0 :   std::string str;
    2101            0 :   if (e.has_where_clause ())
    2102            0 :     str = e.get_where_clause ().to_string ();
    2103              :   else
    2104            0 :     str = "none";
    2105            0 :   put_field ("where clause", str);
    2106              : 
    2107            0 :   do_inner_attrs (e);
    2108              : 
    2109            0 :   visit_collection ("impl_items", e.get_impl_items ());
    2110              : 
    2111            0 :   end ("ImplBlock");
    2112            0 : }
    2113              : 
    2114              : void
    2115            0 : Dump::visit (ExternalStaticItem &e)
    2116              : {
    2117            0 :   begin ("ExternalStaticItem");
    2118              : 
    2119              :   // FIXME do_vis_item... but not a VisItem... But could be?
    2120            0 :   auto oa = e.get_outer_attrs ();
    2121            0 :   do_outer_attrs (oa);
    2122              : 
    2123            0 :   std::string str = "none";
    2124            0 :   if (e.has_visibility ())
    2125            0 :     str = e.get_visibility ().to_string ();
    2126            0 :   put_field ("visibility", str);
    2127              :   //
    2128              : 
    2129            0 :   put_field ("mut", std::to_string (e.is_mut ()));
    2130            0 :   put_field ("name", e.get_item_name ().as_string ());
    2131            0 :   visit_field ("type", e.get_item_type ());
    2132              : 
    2133            0 :   end ("ExternalStaticItem");
    2134            0 : }
    2135              : 
    2136              : void
    2137            0 : Dump::visit (ExternalFunctionItem &e)
    2138              : {
    2139            0 :   begin ("ExternalFunctionItem");
    2140            0 :   do_externalitem (e);
    2141              : 
    2142            0 :   visit_collection ("generic_params", e.get_generic_params ());
    2143              : 
    2144            0 :   std::string str = "none";
    2145            0 :   if (!e.get_function_params ().empty ())
    2146            0 :     for (auto &param : e.get_function_params ())
    2147            0 :       do_namefunctionparam (param);
    2148              :   else
    2149            0 :     put_field ("function_params", "none");
    2150              : 
    2151            0 :   put_field ("has_variadics", std::to_string (e.is_variadic ()));
    2152              : 
    2153            0 :   if (e.has_return_type ())
    2154            0 :     visit_field ("return_type", e.get_return_type ());
    2155              : 
    2156            0 :   end ("ExternalFunctionItem");
    2157            0 : }
    2158              : 
    2159              : void
    2160            0 : Dump::visit (ExternalTypeItem &e)
    2161              : {
    2162            0 :   begin ("ExternalTypeItem");
    2163              : 
    2164            0 :   do_externalitem (e);
    2165              : 
    2166            0 :   end ("ExternalTypeItem");
    2167            0 : }
    2168              : 
    2169              : void
    2170            0 : Dump::visit (ExternBlock &e)
    2171              : {
    2172            0 :   begin ("ExternBlock");
    2173            0 :   do_vis_item (e);
    2174            0 :   do_inner_attrs (e);
    2175              : 
    2176            0 :   put_field ("abi", get_string_from_abi (e.get_abi ()));
    2177              : 
    2178            0 :   visit_collection ("extern_items", e.get_extern_items ());
    2179              : 
    2180            0 :   end ("ExternBlock");
    2181            0 : }
    2182              : 
    2183              : void
    2184            0 : Dump::visit (LiteralPattern &e)
    2185              : {
    2186            0 :   begin ("LiteralPattern");
    2187            0 :   put_field ("lit", e.get_literal ().as_string ());
    2188            0 :   do_mappings (e.get_mappings ());
    2189            0 :   end ("LiteralPattern");
    2190            0 : }
    2191              : 
    2192              : void
    2193            0 : Dump::visit (IdentifierPattern &e)
    2194              : {
    2195            0 :   begin ("IdentifierPattern");
    2196            0 :   put_field ("variable_ident", e.get_identifier ().as_string ());
    2197            0 :   put_field ("is_ref", std::to_string (e.get_is_ref ()));
    2198            0 :   put_field ("mut", std::to_string (e.is_mut ()));
    2199              : 
    2200            0 :   if (e.has_subpattern ())
    2201            0 :     visit_field ("subpattern", e.get_subpattern ());
    2202              :   else
    2203            0 :     put_field ("subpattern", "none");
    2204              : 
    2205            0 :   end ("IdentifierPattern");
    2206            0 : }
    2207              : void
    2208            0 : Dump::visit (WildcardPattern &e)
    2209              : {
    2210            0 :   begin ("WildcardPattern");
    2211            0 :   do_mappings (e.get_mappings ());
    2212            0 :   end ("WildcardPattern");
    2213            0 : }
    2214              : 
    2215              : void
    2216            0 : Dump::visit (RangePatternBoundLiteral &e)
    2217              : {
    2218            0 :   begin ("RangePatternBoundLiteral");
    2219            0 :   put_field ("literal", e.get_literal ().as_string ());
    2220            0 :   put_field ("has_minus", std::to_string (e.get_has_minus ()));
    2221            0 :   end ("RangePatternBoundLiteral");
    2222            0 : }
    2223              : 
    2224              : void
    2225            0 : Dump::visit (RangePatternBoundPath &e)
    2226              : {
    2227            0 :   begin ("RangePatternBoundPath");
    2228            0 :   put_field ("path", e.get_path ().to_string ());
    2229            0 :   end ("RangePatternBoundPath");
    2230            0 : }
    2231              : 
    2232              : void
    2233            0 : Dump::visit (RangePatternBoundQualPath &e)
    2234              : {
    2235            0 :   begin ("RangePatternBoundQualPath");
    2236            0 :   visit_field ("path", e.get_qualified_path ());
    2237            0 :   end ("RangePatternBoundQualPath");
    2238            0 : }
    2239              : 
    2240              : void
    2241            0 : Dump::visit (RangePattern &e)
    2242              : {
    2243            0 :   begin ("RangePattern");
    2244            0 :   do_mappings (e.get_mappings ());
    2245            0 :   put_field ("lower", e.get_lower_bound ().to_string ());
    2246            0 :   put_field ("upper", e.get_upper_bound ().to_string ());
    2247            0 :   put_field ("has_ellipsis_syntax",
    2248            0 :              std::to_string (e.get_has_ellipsis_syntax ()));
    2249            0 :   end ("RangePattern");
    2250            0 : }
    2251              : 
    2252              : void
    2253            0 : Dump::visit (ReferencePattern &e)
    2254              : {
    2255            0 :   begin ("ReferencePattern");
    2256            0 :   do_mappings (e.get_mappings ());
    2257            0 :   put_field ("mut", std::to_string (e.is_mut ()));
    2258            0 :   put_field ("pattern", e.get_referenced_pattern ().to_debug_string ());
    2259            0 :   end ("ReferencePattern");
    2260            0 : }
    2261              : 
    2262              : void
    2263            0 : Dump::visit (StructPatternFieldTuplePat &e)
    2264              : {
    2265            0 :   begin ("StructPatternFieldTuplePat");
    2266            0 :   do_mappings (e.get_mappings ());
    2267            0 :   auto oa = e.get_outer_attrs ();
    2268            0 :   do_outer_attrs (oa);
    2269            0 :   put_field ("index", std::to_string (e.get_index ()));
    2270            0 :   put_field ("tuple_pattern", e.get_tuple_pattern ().to_string ());
    2271            0 :   end ("StructPatternFieldTuplePat");
    2272            0 : }
    2273              : 
    2274              : void
    2275            0 : Dump::visit (StructPatternFieldIdentPat &e)
    2276              : {
    2277            0 :   begin ("StructPatternFieldIdentPat");
    2278            0 :   auto oa = e.get_outer_attrs ();
    2279            0 :   do_outer_attrs (oa);
    2280            0 :   put_field ("ident", e.get_identifier ().as_string ());
    2281            0 :   visit_field ("ident_pattern", e.get_pattern ());
    2282            0 :   end ("StructPatternFieldIdentPat");
    2283            0 : }
    2284              : 
    2285              : void
    2286            0 : Dump::visit (StructPatternFieldIdent &e)
    2287              : {
    2288            0 :   begin ("StructPatternFieldIdent");
    2289            0 :   auto oa = e.get_outer_attrs ();
    2290            0 :   do_outer_attrs (oa);
    2291              : 
    2292            0 :   put_field ("has_ref", std::to_string (e.get_has_ref ()));
    2293            0 :   put_field ("mut", std::to_string (e.is_mut ()));
    2294            0 :   put_field ("ident", e.get_identifier ().as_string ());
    2295            0 :   end ("StructPatternFieldIdent");
    2296            0 : }
    2297              : 
    2298              : void
    2299            0 : Dump::visit (StructPattern &e)
    2300              : {
    2301            0 :   begin ("StructPattern");
    2302              : 
    2303            0 :   visit_field ("path", e.get_path ());
    2304            0 :   put_field ("elems", e.get_struct_pattern_elems ().to_string ());
    2305              : 
    2306            0 :   end ("StructPattern");
    2307            0 : }
    2308              : 
    2309              : void
    2310            0 : Dump::visit (TupleStructItemsNoRest &e)
    2311              : {
    2312            0 :   begin ("TupleStructItemsNoRest");
    2313            0 :   visit_collection ("patterns", e.get_patterns ());
    2314            0 :   end ("TupleStructItemsNoRest");
    2315            0 : }
    2316              : 
    2317              : void
    2318            0 : Dump::visit (TupleStructItemsHasRest &e)
    2319              : {
    2320            0 :   begin ("TupleStructItemsHasRest");
    2321            0 :   visit_collection ("lower_patterns", e.get_lower_patterns ());
    2322            0 :   visit_collection ("upper_patterns", e.get_upper_patterns ());
    2323            0 :   end ("TupleStructItemsHasRest");
    2324            0 : }
    2325              : 
    2326              : void
    2327            0 : Dump::visit (TupleStructPattern &e)
    2328              : {
    2329            0 :   begin ("TupleStructPattern");
    2330            0 :   do_mappings (e.get_mappings ());
    2331              : 
    2332            0 :   put_field ("path", e.get_path ().to_string ());
    2333              : 
    2334            0 :   visit_field ("items", e.get_items ());
    2335              : 
    2336            0 :   end ("TupleStructPattern");
    2337            0 : }
    2338              : 
    2339              : void
    2340            0 : Dump::visit (TuplePatternItemsNoRest &e)
    2341              : {
    2342            0 :   begin ("TuplePatternItemsNoRest");
    2343            0 :   visit_collection ("patterns", e.get_patterns ());
    2344            0 :   end ("TuplePatternItemsNoRest");
    2345            0 : }
    2346              : 
    2347              : void
    2348            0 : Dump::visit (TuplePatternItemsHasRest &e)
    2349              : {
    2350            0 :   begin ("TuplePatternItemsHasRest");
    2351            0 :   visit_collection ("lower_patterns", e.get_lower_patterns ());
    2352            0 :   visit_collection ("upper_patterns", e.get_upper_patterns ());
    2353            0 :   end ("TuplePatternItemsHasRest");
    2354            0 : }
    2355              : 
    2356              : void
    2357            0 : Dump::visit (TuplePattern &e)
    2358              : {
    2359            0 :   begin ("TuplePattern");
    2360            0 :   do_mappings (e.get_mappings ());
    2361            0 :   visit_field ("items", e.get_items ());
    2362            0 :   end ("TuplePattern");
    2363            0 : }
    2364              : 
    2365              : void
    2366            0 : Dump::visit (SlicePatternItemsNoRest &e)
    2367              : {
    2368            0 :   begin ("SlicePatternItemsNoRest");
    2369            0 :   visit_collection ("patterns", e.get_patterns ());
    2370            0 :   end ("SlicePatternItemsNoRest");
    2371            0 : }
    2372              : 
    2373              : void
    2374            0 : Dump::visit (SlicePatternItemsHasRest &e)
    2375              : {
    2376            0 :   begin ("SlicePatternItemsHasRest");
    2377            0 :   visit_collection ("lower_patterns", e.get_lower_patterns ());
    2378            0 :   visit_collection ("upper_patterns", e.get_upper_patterns ());
    2379            0 :   end ("SlicePatternItemsHasRest");
    2380            0 : }
    2381              : 
    2382              : void
    2383            0 : Dump::visit (SlicePattern &e)
    2384              : {
    2385            0 :   begin ("SlicePattern");
    2386            0 :   do_mappings (e.get_mappings ());
    2387            0 :   visit_field ("items", e.get_items ());
    2388            0 :   end ("SlicePattern");
    2389            0 : }
    2390              : 
    2391              : void
    2392            0 : Dump::visit (AltPattern &e)
    2393              : {
    2394            0 :   begin ("AltPattern");
    2395            0 :   do_mappings (e.get_mappings ());
    2396            0 :   visit_collection ("alts", e.get_alts ());
    2397            0 :   end ("AltPattern");
    2398            0 : }
    2399              : 
    2400              : void
    2401            0 : Dump::visit (EmptyStmt &e)
    2402              : {
    2403            0 :   begin ("EmptyStmt");
    2404            0 :   do_stmt (e);
    2405            0 :   end ("EmptyStmt");
    2406            0 : }
    2407              : 
    2408              : void
    2409            0 : Dump::visit (LetStmt &e)
    2410              : {
    2411            0 :   begin ("LetStmt");
    2412            0 :   do_stmt (e);
    2413            0 :   auto oa = e.get_outer_attrs ();
    2414            0 :   do_outer_attrs (oa);
    2415              : 
    2416            0 :   visit_field ("variable_pattern", e.get_pattern ());
    2417              : 
    2418            0 :   if (e.has_type ())
    2419            0 :     visit_field ("type", e.get_type ());
    2420            0 :   if (e.has_init_expr ())
    2421            0 :     visit_field ("init_expr", e.get_init_expr ());
    2422              : 
    2423            0 :   end ("LetStmt");
    2424            0 : }
    2425              : 
    2426              : void
    2427            0 : Dump::visit (ExprStmt &e)
    2428              : {
    2429            0 :   begin ("ExprStmt");
    2430            0 :   do_stmt (e);
    2431            0 :   put_field ("must_be_unit", std::to_string (e.is_unit_check_needed ()));
    2432            0 :   visit_field ("expr", e.get_expr ());
    2433            0 :   end ("ExprStmt");
    2434            0 : }
    2435              : 
    2436              : void
    2437            0 : Dump::visit (TraitBound &e)
    2438              : {
    2439            0 :   begin ("TraitBound");
    2440            0 :   do_mappings (e.get_mappings ());
    2441            0 :   put_field ("in_parens", std::to_string (e.get_in_parens ()));
    2442            0 :   put_field ("polarity", BoundPolarityString (e.get_polarity ()));
    2443              : 
    2444            0 :   visit_collection ("for_lifetime", e.get_for_lifetimes ());
    2445            0 :   visit_field ("type_path", e.get_path ());
    2446              : 
    2447            0 :   end ("TraitBound");
    2448            0 : }
    2449              : 
    2450              : void
    2451            0 : Dump::visit (ImplTraitType &e)
    2452              : {
    2453            0 :   begin ("ImplTraitType");
    2454            0 :   do_type (e);
    2455              : 
    2456            0 :   visit_collection ("type_param_bounds", e.get_type_param_bounds ());
    2457              : 
    2458            0 :   end ("ImplTraitType");
    2459            0 : }
    2460              : 
    2461              : void
    2462            0 : Dump::visit (TraitObjectType &e)
    2463              : {
    2464            0 :   begin ("TraitObjectType");
    2465            0 :   do_type (e);
    2466              : 
    2467            0 :   put_field ("has_dyn", std::to_string (e.get_has_dyn ()));
    2468              : 
    2469            0 :   visit_collection ("type_param_bounds", e.get_type_param_bounds ());
    2470              : 
    2471            0 :   end ("TraitObjectType");
    2472            0 : }
    2473              : 
    2474              : void
    2475            0 : Dump::visit (ParenthesisedType &e)
    2476              : {
    2477            0 :   begin ("ParenthesisedType");
    2478            0 :   do_type (e);
    2479            0 :   put_field ("type_in_parens", e.get_type_in_parens ().to_debug_string ());
    2480            0 :   end ("ParenthesisedType");
    2481            0 : }
    2482              : 
    2483              : void
    2484            0 : Dump::visit (TupleType &e)
    2485              : {
    2486            0 :   begin ("TupleType");
    2487            0 :   do_type (e);
    2488            0 :   visit_collection ("elems", e.get_elems ());
    2489            0 :   end ("TupleType");
    2490            0 : }
    2491              : 
    2492              : void
    2493            0 : Dump::visit (NeverType &e)
    2494              : {
    2495            0 :   begin ("NeverType");
    2496            0 :   do_type (e);
    2497            0 :   end ("NeverType");
    2498            0 : }
    2499              : 
    2500              : void
    2501            0 : Dump::visit (RawPointerType &e)
    2502              : {
    2503            0 :   begin ("RawPointerType");
    2504            0 :   do_type (e);
    2505            0 :   put_field ("mut", Rust::enum_to_str (e.get_mut ()));
    2506            0 :   put_field ("type", e.get_type ().to_debug_string ());
    2507            0 :   end ("RawPointerType");
    2508            0 : }
    2509              : 
    2510              : void
    2511            0 : Dump::visit (ReferenceType &e)
    2512              : {
    2513            0 :   begin ("ReferenceType");
    2514            0 :   do_type (e);
    2515            0 :   put_field ("lifetime", e.get_lifetime ().to_string ());
    2516            0 :   put_field ("mut", enum_to_str (e.get_mut ()));
    2517            0 :   put_field ("type", e.get_base_type ().to_debug_string ());
    2518            0 :   end ("ReferenceType");
    2519            0 : }
    2520              : 
    2521              : void
    2522            0 : Dump::visit (ArrayType &e)
    2523              : {
    2524            0 :   begin ("ArrayType");
    2525            0 :   do_type (e);
    2526            0 :   visit_field ("type", e.get_element_type ());
    2527            0 :   visit_field ("size", e.get_size_expr ());
    2528            0 :   end ("ArrayType");
    2529            0 : }
    2530              : 
    2531              : void
    2532            0 : Dump::visit (SliceType &e)
    2533              : {
    2534            0 :   begin ("SliceType");
    2535            0 :   do_type (e);
    2536            0 :   visit_field ("elem_type", e.get_element_type ());
    2537            0 :   end ("SliceType");
    2538            0 : }
    2539              : 
    2540              : void
    2541            0 : Dump::visit (InferredType &e)
    2542              : {
    2543            0 :   begin ("InferredType");
    2544            0 :   do_type (e);
    2545            0 :   end ("InferredType");
    2546            0 : }
    2547              : 
    2548              : void
    2549            0 : Dump::visit (BareFunctionType &e)
    2550              : {
    2551            0 :   begin ("BareFunctionType");
    2552            0 :   do_type (e);
    2553              : 
    2554            0 :   visit_collection ("for_lifetimes", e.get_for_lifetimes ());
    2555              : 
    2556            0 :   put_field ("function_qualifiers", e.get_function_qualifiers ().to_string ());
    2557              : 
    2558            0 :   if (e.get_function_params ().empty ())
    2559              :     {
    2560            0 :       put_field ("params", "none");
    2561              :     }
    2562              :   else
    2563              :     {
    2564            0 :       begin_field ("params");
    2565            0 :       for (auto &param : e.get_function_params ())
    2566              :         {
    2567            0 :           begin ("MaybeNamedParam");
    2568            0 :           do_maybenamedparam (param);
    2569            0 :           end ("MaybeNamedParam");
    2570              :         }
    2571            0 :       end_field ("params");
    2572              :     }
    2573              : 
    2574            0 :   if (e.has_return_type ())
    2575            0 :     visit_field ("return_type", e.get_return_type ());
    2576              : 
    2577            0 :   put_field ("is_variadic", std::to_string (e.get_is_variadic ()));
    2578            0 :   end ("BareFunctionType");
    2579            0 : }
    2580              : 
    2581              : } // namespace HIR
    2582              : } // namespace Rust
    2583              : 
    2584              : // In the global namespace to make it easier to call from debugger
    2585              : void
    2586            0 : debug (Rust::HIR::FullVisitable &v)
    2587              : {
    2588            0 :   Rust::HIR::Dump::debug (v);
    2589            0 : }
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.