LCOV - code coverage report
Current view: top level - gcc/rust/hir - rust-ast-lower-base.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 43.3 % 580 251
Test Date: 2024-04-20 14:03:02 Functions: 13.8 % 174 24
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (C) 2020-2024 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-ast-lower-base.h"
      20                 :             : #include "rust-ast-lower-type.h"
      21                 :             : #include "rust-ast-lower-pattern.h"
      22                 :             : #include "rust-ast-lower-extern.h"
      23                 :             : #include "rust-attribute-values.h"
      24                 :             : #include "rust-item.h"
      25                 :             : #include "rust-system.h"
      26                 :             : 
      27                 :             : namespace Rust {
      28                 :             : namespace HIR {
      29                 :             : 
      30                 :             : void
      31                 :           0 : ASTLoweringBase::visit (AST::Token &)
      32                 :           0 : {}
      33                 :             : void
      34                 :           0 : ASTLoweringBase::visit (AST::DelimTokenTree &)
      35                 :           0 : {}
      36                 :             : void
      37                 :           0 : ASTLoweringBase::visit (AST::AttrInputMetaItemContainer &)
      38                 :           0 : {}
      39                 :             : //  void ASTLoweringBase::visit(MetaItemmeta_item) {}
      40                 :             : //  void vsit(Stmtstmt) {}
      41                 :             : //  void ASTLoweringBase::visit(Exprexpr) {}
      42                 :             : void
      43                 :           0 : ASTLoweringBase::visit (AST::IdentifierExpr &)
      44                 :           0 : {}
      45                 :             : //  void ASTLoweringBase::visit(Patternpattern) {}
      46                 :             : //  void ASTLoweringBase::visit(Typetype) {}
      47                 :             : //  void ASTLoweringBase::visit(TypeParamBoundtype_param_bound) {}
      48                 :             : void
      49                 :           0 : ASTLoweringBase::visit (AST::Lifetime &)
      50                 :           0 : {}
      51                 :             : //  void ASTLoweringBase::visit(GenericParamgeneric_param) {}
      52                 :             : void
      53                 :           0 : ASTLoweringBase::visit (AST::LifetimeParam &)
      54                 :           0 : {}
      55                 :             : void
      56                 :           0 : ASTLoweringBase::visit (AST::ConstGenericParam &)
      57                 :           0 : {}
      58                 :             : //  void ASTLoweringBase::visit(TraitItemtrait_item) {}
      59                 :             : //  void ASTLoweringBase::visit(InherentImplIteminherent_impl_item) {}
      60                 :             : //  void ASTLoweringBase::visit(TraitImplItemtrait_impl_item) {}
      61                 :             : 
      62                 :             : // rust-path.h
      63                 :             : void
      64                 :           0 : ASTLoweringBase::visit (AST::PathInExpression &)
      65                 :           0 : {}
      66                 :             : void
      67                 :           0 : ASTLoweringBase::visit (AST::TypePathSegment &)
      68                 :           0 : {}
      69                 :             : void
      70                 :           0 : ASTLoweringBase::visit (AST::TypePathSegmentGeneric &)
      71                 :           0 : {}
      72                 :             : void
      73                 :           0 : ASTLoweringBase::visit (AST::TypePathSegmentFunction &)
      74                 :           0 : {}
      75                 :             : void
      76                 :           0 : ASTLoweringBase::visit (AST::TypePath &)
      77                 :           0 : {}
      78                 :             : void
      79                 :           0 : ASTLoweringBase::visit (AST::QualifiedPathInExpression &)
      80                 :           0 : {}
      81                 :             : void
      82                 :           0 : ASTLoweringBase::visit (AST::QualifiedPathInType &)
      83                 :           0 : {}
      84                 :             : 
      85                 :             : // rust-expr.h
      86                 :             : void
      87                 :           0 : ASTLoweringBase::visit (AST::LiteralExpr &)
      88                 :           0 : {}
      89                 :             : void
      90                 :           0 : ASTLoweringBase::visit (AST::AttrInputLiteral &)
      91                 :           0 : {}
      92                 :             : void
      93                 :           0 : ASTLoweringBase::visit (AST::AttrInputMacro &)
      94                 :           0 : {}
      95                 :             : void
      96                 :           0 : ASTLoweringBase::visit (AST::MetaItemLitExpr &)
      97                 :           0 : {}
      98                 :             : void
      99                 :           0 : ASTLoweringBase::visit (AST::MetaItemPathLit &)
     100                 :           0 : {}
     101                 :             : void
     102                 :           0 : ASTLoweringBase::visit (AST::BorrowExpr &)
     103                 :           0 : {}
     104                 :             : void
     105                 :           0 : ASTLoweringBase::visit (AST::DereferenceExpr &)
     106                 :           0 : {}
     107                 :             : void
     108                 :           0 : ASTLoweringBase::visit (AST::ErrorPropagationExpr &)
     109                 :           0 : {}
     110                 :             : void
     111                 :           0 : ASTLoweringBase::visit (AST::NegationExpr &)
     112                 :           0 : {}
     113                 :             : void
     114                 :           0 : ASTLoweringBase::visit (AST::ArithmeticOrLogicalExpr &)
     115                 :           0 : {}
     116                 :             : void
     117                 :           0 : ASTLoweringBase::visit (AST::ComparisonExpr &)
     118                 :           0 : {}
     119                 :             : void
     120                 :           0 : ASTLoweringBase::visit (AST::LazyBooleanExpr &)
     121                 :           0 : {}
     122                 :             : void
     123                 :           0 : ASTLoweringBase::visit (AST::TypeCastExpr &)
     124                 :           0 : {}
     125                 :             : void
     126                 :           0 : ASTLoweringBase::visit (AST::AssignmentExpr &)
     127                 :           0 : {}
     128                 :             : void
     129                 :           0 : ASTLoweringBase::visit (AST::CompoundAssignmentExpr &)
     130                 :           0 : {}
     131                 :             : void
     132                 :           0 : ASTLoweringBase::visit (AST::GroupedExpr &)
     133                 :           0 : {}
     134                 :             : //  void ASTLoweringBase::visit(ArrayElemselems) {}
     135                 :             : void
     136                 :           0 : ASTLoweringBase::visit (AST::ArrayElemsValues &)
     137                 :           0 : {}
     138                 :             : void
     139                 :           0 : ASTLoweringBase::visit (AST::ArrayElemsCopied &)
     140                 :           0 : {}
     141                 :             : void
     142                 :           0 : ASTLoweringBase::visit (AST::ArrayExpr &)
     143                 :           0 : {}
     144                 :             : void
     145                 :           0 : ASTLoweringBase::visit (AST::ArrayIndexExpr &)
     146                 :           0 : {}
     147                 :             : void
     148                 :           0 : ASTLoweringBase::visit (AST::TupleExpr &)
     149                 :           0 : {}
     150                 :             : void
     151                 :           0 : ASTLoweringBase::visit (AST::TupleIndexExpr &)
     152                 :           0 : {}
     153                 :             : void
     154                 :           0 : ASTLoweringBase::visit (AST::StructExprStruct &)
     155                 :           0 : {}
     156                 :             : //  void ASTLoweringBase::visit(StructExprFieldfield) {}
     157                 :             : void
     158                 :           0 : ASTLoweringBase::visit (AST::StructExprFieldIdentifier &)
     159                 :           0 : {}
     160                 :             : void
     161                 :           0 : ASTLoweringBase::visit (AST::StructExprFieldIdentifierValue &)
     162                 :           0 : {}
     163                 :             : void
     164                 :           0 : ASTLoweringBase::visit (AST::StructExprFieldIndexValue &)
     165                 :           0 : {}
     166                 :             : void
     167                 :           0 : ASTLoweringBase::visit (AST::StructExprStructFields &)
     168                 :           0 : {}
     169                 :             : void
     170                 :           0 : ASTLoweringBase::visit (AST::StructExprStructBase &)
     171                 :           0 : {}
     172                 :             : void
     173                 :           0 : ASTLoweringBase::visit (AST::CallExpr &)
     174                 :           0 : {}
     175                 :             : void
     176                 :           0 : ASTLoweringBase::visit (AST::MethodCallExpr &)
     177                 :           0 : {}
     178                 :             : void
     179                 :           0 : ASTLoweringBase::visit (AST::FieldAccessExpr &)
     180                 :           0 : {}
     181                 :             : void
     182                 :           0 : ASTLoweringBase::visit (AST::ClosureExprInner &)
     183                 :           0 : {}
     184                 :             : void
     185                 :           0 : ASTLoweringBase::visit (AST::BlockExpr &)
     186                 :           0 : {}
     187                 :             : void
     188                 :           0 : ASTLoweringBase::visit (AST::ClosureExprInnerTyped &)
     189                 :           0 : {}
     190                 :             : void
     191                 :           0 : ASTLoweringBase::visit (AST::ContinueExpr &)
     192                 :           0 : {}
     193                 :             : void
     194                 :           0 : ASTLoweringBase::visit (AST::BreakExpr &)
     195                 :           0 : {}
     196                 :             : void
     197                 :           0 : ASTLoweringBase::visit (AST::RangeFromToExpr &)
     198                 :           0 : {}
     199                 :             : void
     200                 :           0 : ASTLoweringBase::visit (AST::RangeFromExpr &)
     201                 :           0 : {}
     202                 :             : void
     203                 :           0 : ASTLoweringBase::visit (AST::RangeToExpr &)
     204                 :           0 : {}
     205                 :             : void
     206                 :           0 : ASTLoweringBase::visit (AST::RangeFullExpr &)
     207                 :           0 : {}
     208                 :             : void
     209                 :           0 : ASTLoweringBase::visit (AST::RangeFromToInclExpr &)
     210                 :           0 : {}
     211                 :             : void
     212                 :           0 : ASTLoweringBase::visit (AST::RangeToInclExpr &)
     213                 :           0 : {}
     214                 :             : void
     215                 :           0 : ASTLoweringBase::visit (AST::ReturnExpr &)
     216                 :           0 : {}
     217                 :             : void
     218                 :           0 : ASTLoweringBase::visit (AST::UnsafeBlockExpr &)
     219                 :           0 : {}
     220                 :             : void
     221                 :           0 : ASTLoweringBase::visit (AST::LoopExpr &)
     222                 :           0 : {}
     223                 :             : void
     224                 :           0 : ASTLoweringBase::visit (AST::WhileLoopExpr &)
     225                 :           0 : {}
     226                 :             : void
     227                 :           0 : ASTLoweringBase::visit (AST::WhileLetLoopExpr &)
     228                 :           0 : {}
     229                 :             : void
     230                 :           0 : ASTLoweringBase::visit (AST::ForLoopExpr &)
     231                 :           0 : {}
     232                 :             : void
     233                 :           0 : ASTLoweringBase::visit (AST::IfExpr &)
     234                 :           0 : {}
     235                 :             : void
     236                 :           0 : ASTLoweringBase::visit (AST::IfExprConseqElse &)
     237                 :           0 : {}
     238                 :             : void
     239                 :           0 : ASTLoweringBase::visit (AST::IfLetExpr &)
     240                 :           0 : {}
     241                 :             : void
     242                 :           0 : ASTLoweringBase::visit (AST::IfLetExprConseqElse &)
     243                 :           0 : {}
     244                 :             : //  void ASTLoweringBase::visit(MatchCasematch_case) {}
     245                 :             : // void ASTLoweringBase:: (AST::MatchCaseBlockExpr &) {}
     246                 :             : // void ASTLoweringBase:: (AST::MatchCaseExpr &) {}
     247                 :             : void
     248                 :           0 : ASTLoweringBase::visit (AST::MatchExpr &)
     249                 :           0 : {}
     250                 :             : void
     251                 :           0 : ASTLoweringBase::visit (AST::AwaitExpr &)
     252                 :           0 : {}
     253                 :             : void
     254                 :           0 : ASTLoweringBase::visit (AST::AsyncBlockExpr &)
     255                 :           0 : {}
     256                 :             : 
     257                 :             : // rust-item.h
     258                 :             : void
     259                 :           0 : ASTLoweringBase::visit (AST::TypeParam &)
     260                 :           0 : {}
     261                 :             : //  void ASTLoweringBase::visit(WhereClauseItemitem) {}
     262                 :             : void
     263                 :           0 : ASTLoweringBase::visit (AST::LifetimeWhereClauseItem &)
     264                 :           0 : {}
     265                 :             : void
     266                 :           0 : ASTLoweringBase::visit (AST::TypeBoundWhereClauseItem &)
     267                 :           0 : {}
     268                 :             : void
     269                 :           0 : ASTLoweringBase::visit (AST::Module &)
     270                 :           0 : {}
     271                 :             : void
     272                 :           8 : ASTLoweringBase::visit (AST::ExternCrate &)
     273                 :           8 : {}
     274                 :             : //  void ASTLoweringBase::visit(UseTreeuse_tree) {}
     275                 :             : void
     276                 :           0 : ASTLoweringBase::visit (AST::UseTreeGlob &)
     277                 :           0 : {}
     278                 :             : void
     279                 :           0 : ASTLoweringBase::visit (AST::UseTreeList &)
     280                 :           0 : {}
     281                 :             : void
     282                 :           0 : ASTLoweringBase::visit (AST::UseTreeRebind &)
     283                 :           0 : {}
     284                 :             : void
     285                 :          31 : ASTLoweringBase::visit (AST::UseDeclaration &)
     286                 :          31 : {}
     287                 :             : void
     288                 :           0 : ASTLoweringBase::visit (AST::Function &)
     289                 :           0 : {}
     290                 :             : void
     291                 :           1 : ASTLoweringBase::visit (AST::TypeAlias &)
     292                 :           1 : {}
     293                 :             : void
     294                 :           0 : ASTLoweringBase::visit (AST::StructStruct &)
     295                 :           0 : {}
     296                 :             : void
     297                 :           0 : ASTLoweringBase::visit (AST::TupleStruct &)
     298                 :           0 : {}
     299                 :             : void
     300                 :           0 : ASTLoweringBase::visit (AST::EnumItem &)
     301                 :           0 : {}
     302                 :             : void
     303                 :           0 : ASTLoweringBase::visit (AST::EnumItemTuple &)
     304                 :           0 : {}
     305                 :             : void
     306                 :           0 : ASTLoweringBase::visit (AST::EnumItemStruct &)
     307                 :           0 : {}
     308                 :             : void
     309                 :           0 : ASTLoweringBase::visit (AST::EnumItemDiscriminant &)
     310                 :           0 : {}
     311                 :             : void
     312                 :           0 : ASTLoweringBase::visit (AST::Enum &)
     313                 :           0 : {}
     314                 :             : void
     315                 :           0 : ASTLoweringBase::visit (AST::Union &)
     316                 :           0 : {}
     317                 :             : void
     318                 :           0 : ASTLoweringBase::visit (AST::ConstantItem &)
     319                 :           0 : {}
     320                 :             : void
     321                 :           0 : ASTLoweringBase::visit (AST::StaticItem &)
     322                 :           0 : {}
     323                 :             : void
     324                 :           0 : ASTLoweringBase::visit (AST::TraitItemConst &)
     325                 :           0 : {}
     326                 :             : void
     327                 :           0 : ASTLoweringBase::visit (AST::TraitItemType &)
     328                 :           0 : {}
     329                 :             : void
     330                 :           0 : ASTLoweringBase::visit (AST::Trait &)
     331                 :           0 : {}
     332                 :             : void
     333                 :           0 : ASTLoweringBase::visit (AST::InherentImpl &)
     334                 :           0 : {}
     335                 :             : void
     336                 :           0 : ASTLoweringBase::visit (AST::TraitImpl &)
     337                 :           0 : {}
     338                 :             : //  void ASTLoweringBase::visit(ExternalItemitem) {}
     339                 :             : void
     340                 :           0 : ASTLoweringBase::visit (AST::ExternalTypeItem &)
     341                 :           0 : {}
     342                 :             : void
     343                 :           0 : ASTLoweringBase::visit (AST::ExternalStaticItem &)
     344                 :           0 : {}
     345                 :             : void
     346                 :           0 : ASTLoweringBase::visit (AST::ExternalFunctionItem &)
     347                 :           0 : {}
     348                 :             : void
     349                 :           0 : ASTLoweringBase::visit (AST::ExternBlock &)
     350                 :           0 : {}
     351                 :             : 
     352                 :             : // rust-macro.h
     353                 :             : void
     354                 :           0 : ASTLoweringBase::visit (AST::MacroMatchFragment &)
     355                 :           0 : {}
     356                 :             : void
     357                 :           0 : ASTLoweringBase::visit (AST::MacroMatchRepetition &)
     358                 :           0 : {}
     359                 :             : void
     360                 :           0 : ASTLoweringBase::visit (AST::MacroMatcher &)
     361                 :           0 : {}
     362                 :             : void
     363                 :           0 : ASTLoweringBase::visit (AST::MacroRulesDefinition &)
     364                 :           0 : {}
     365                 :             : void
     366                 :           0 : ASTLoweringBase::visit (AST::MacroInvocation &)
     367                 :           0 : {}
     368                 :             : void
     369                 :           0 : ASTLoweringBase::visit (AST::MetaItemPath &)
     370                 :           0 : {}
     371                 :             : void
     372                 :           0 : ASTLoweringBase::visit (AST::MetaItemSeq &)
     373                 :           0 : {}
     374                 :             : void
     375                 :           0 : ASTLoweringBase::visit (AST::MetaWord &)
     376                 :           0 : {}
     377                 :             : void
     378                 :           0 : ASTLoweringBase::visit (AST::MetaNameValueStr &)
     379                 :           0 : {}
     380                 :             : void
     381                 :           0 : ASTLoweringBase::visit (AST::MetaListPaths &)
     382                 :           0 : {}
     383                 :             : void
     384                 :           0 : ASTLoweringBase::visit (AST::MetaListNameValueStr &)
     385                 :           0 : {}
     386                 :             : 
     387                 :             : // rust-pattern.h
     388                 :             : void
     389                 :           0 : ASTLoweringBase::visit (AST::LiteralPattern &)
     390                 :           0 : {}
     391                 :             : void
     392                 :           0 : ASTLoweringBase::visit (AST::IdentifierPattern &)
     393                 :           0 : {}
     394                 :             : void
     395                 :           0 : ASTLoweringBase::visit (AST::WildcardPattern &)
     396                 :           0 : {}
     397                 :             : void
     398                 :           0 : ASTLoweringBase::visit (AST::RestPattern &)
     399                 :           0 : {}
     400                 :             : //  void ASTLoweringBase::visit(RangePatternBoundbound) {}
     401                 :             : void
     402                 :           0 : ASTLoweringBase::visit (AST::RangePatternBoundLiteral &)
     403                 :           0 : {}
     404                 :             : void
     405                 :           0 : ASTLoweringBase::visit (AST::RangePatternBoundPath &)
     406                 :           0 : {}
     407                 :             : void
     408                 :           0 : ASTLoweringBase::visit (AST::RangePatternBoundQualPath &)
     409                 :           0 : {}
     410                 :             : void
     411                 :           0 : ASTLoweringBase::visit (AST::RangePattern &)
     412                 :           0 : {}
     413                 :             : void
     414                 :           0 : ASTLoweringBase::visit (AST::ReferencePattern &)
     415                 :           0 : {}
     416                 :             : //  void ASTLoweringBase::visit(StructPatternFieldfield) {}
     417                 :             : void
     418                 :           0 : ASTLoweringBase::visit (AST::StructPatternFieldTuplePat &)
     419                 :           0 : {}
     420                 :             : void
     421                 :           0 : ASTLoweringBase::visit (AST::StructPatternFieldIdentPat &)
     422                 :           0 : {}
     423                 :             : void
     424                 :           0 : ASTLoweringBase::visit (AST::StructPatternFieldIdent &)
     425                 :           0 : {}
     426                 :             : void
     427                 :           0 : ASTLoweringBase::visit (AST::StructPattern &)
     428                 :           0 : {}
     429                 :             : //  void ASTLoweringBase::visit(TupleStructItemstuple_items) {}
     430                 :             : void
     431                 :           0 : ASTLoweringBase::visit (AST::TupleStructItemsNoRange &)
     432                 :           0 : {}
     433                 :             : void
     434                 :           0 : ASTLoweringBase::visit (AST::TupleStructItemsRange &)
     435                 :           0 : {}
     436                 :             : void
     437                 :           0 : ASTLoweringBase::visit (AST::TupleStructPattern &)
     438                 :           0 : {}
     439                 :             : //  void ASTLoweringBase::visit(TuplePatternItemstuple_items) {}
     440                 :             : void
     441                 :           0 : ASTLoweringBase::visit (AST::TuplePatternItemsMultiple &)
     442                 :           0 : {}
     443                 :             : void
     444                 :           0 : ASTLoweringBase::visit (AST::TuplePatternItemsRanged &)
     445                 :           0 : {}
     446                 :             : void
     447                 :           0 : ASTLoweringBase::visit (AST::TuplePattern &)
     448                 :           0 : {}
     449                 :             : void
     450                 :           0 : ASTLoweringBase::visit (AST::GroupedPattern &)
     451                 :           0 : {}
     452                 :             : void
     453                 :           0 : ASTLoweringBase::visit (AST::SlicePattern &)
     454                 :           0 : {}
     455                 :             : void
     456                 :           0 : ASTLoweringBase::visit (AST::AltPattern &)
     457                 :           0 : {}
     458                 :             : 
     459                 :             : // rust-stmt.h
     460                 :             : void
     461                 :           0 : ASTLoweringBase::visit (AST::EmptyStmt &)
     462                 :           0 : {}
     463                 :             : void
     464                 :           0 : ASTLoweringBase::visit (AST::LetStmt &)
     465                 :           0 : {}
     466                 :             : void
     467                 :           0 : ASTLoweringBase::visit (AST::ExprStmt &)
     468                 :           0 : {}
     469                 :             : 
     470                 :             : // rust-type.h
     471                 :             : void
     472                 :           0 : ASTLoweringBase::visit (AST::TraitBound &)
     473                 :           0 : {}
     474                 :             : void
     475                 :           0 : ASTLoweringBase::visit (AST::ImplTraitType &)
     476                 :           0 : {}
     477                 :             : void
     478                 :           0 : ASTLoweringBase::visit (AST::TraitObjectType &)
     479                 :           0 : {}
     480                 :             : void
     481                 :           0 : ASTLoweringBase::visit (AST::ParenthesisedType &)
     482                 :           0 : {}
     483                 :             : void
     484                 :           0 : ASTLoweringBase::visit (AST::ImplTraitTypeOneBound &)
     485                 :           0 : {}
     486                 :             : void
     487                 :           0 : ASTLoweringBase::visit (AST::TraitObjectTypeOneBound &)
     488                 :           0 : {}
     489                 :             : void
     490                 :           0 : ASTLoweringBase::visit (AST::TupleType &)
     491                 :           0 : {}
     492                 :             : void
     493                 :           0 : ASTLoweringBase::visit (AST::NeverType &)
     494                 :           0 : {}
     495                 :             : void
     496                 :           0 : ASTLoweringBase::visit (AST::RawPointerType &)
     497                 :           0 : {}
     498                 :             : void
     499                 :           0 : ASTLoweringBase::visit (AST::ReferenceType &)
     500                 :           0 : {}
     501                 :             : void
     502                 :           0 : ASTLoweringBase::visit (AST::ArrayType &)
     503                 :           0 : {}
     504                 :             : void
     505                 :           0 : ASTLoweringBase::visit (AST::SliceType &)
     506                 :           0 : {}
     507                 :             : void
     508                 :           0 : ASTLoweringBase::visit (AST::InferredType &)
     509                 :           0 : {}
     510                 :             : void
     511                 :           0 : ASTLoweringBase::visit (AST::BareFunctionType &)
     512                 :           0 : {}
     513                 :             : 
     514                 :             : void
     515                 :           0 : ASTLoweringBase::visit (AST::FunctionParam &param)
     516                 :           0 : {}
     517                 :             : 
     518                 :             : void
     519                 :           0 : ASTLoweringBase::visit (AST::VariadicParam &param)
     520                 :           0 : {}
     521                 :             : 
     522                 :             : void
     523                 :           0 : ASTLoweringBase::visit (AST::SelfParam &param)
     524                 :           0 : {}
     525                 :             : 
     526                 :             : HIR::Lifetime
     527                 :       16558 : ASTLoweringBase::lower_lifetime (AST::Lifetime &lifetime,
     528                 :             :                                  bool default_to_static_lifetime)
     529                 :             : {
     530                 :       16558 :   auto lifetime_type = lifetime.get_lifetime_type ();
     531                 :       16558 :   if (lifetime_type == AST::Lifetime::WILDCARD && default_to_static_lifetime)
     532                 :             :     {
     533                 :             :       // If compiling in a static context.
     534                 :           8 :       lifetime_type = AST::Lifetime::STATIC;
     535                 :             :     }
     536                 :             : 
     537                 :       16558 :   auto crate_num = mappings->get_current_crate ();
     538                 :       16558 :   Analysis::NodeMapping mapping (crate_num, lifetime.get_node_id (),
     539                 :       16558 :                                  mappings->get_next_hir_id (crate_num),
     540                 :       16558 :                                  UNKNOWN_LOCAL_DEFID);
     541                 :       16558 :   mappings->insert_node_to_hir (mapping.get_nodeid (), mapping.get_hirid ());
     542                 :             : 
     543                 :       16558 :   return HIR::Lifetime (mapping, lifetime_type, lifetime.get_lifetime_name (),
     544                 :       33116 :                         lifetime.get_locus ());
     545                 :             : }
     546                 :             : 
     547                 :             : HIR::LoopLabel
     548                 :       12907 : ASTLoweringBase::lower_loop_label (AST::LoopLabel &loop_label)
     549                 :             : {
     550                 :       12907 :   HIR::Lifetime life = lower_lifetime (loop_label.get_lifetime ());
     551                 :             : 
     552                 :       12907 :   auto crate_num = mappings->get_current_crate ();
     553                 :       12907 :   Analysis::NodeMapping mapping (crate_num, loop_label.get_node_id (),
     554                 :       12907 :                                  mappings->get_next_hir_id (crate_num),
     555                 :       12907 :                                  UNKNOWN_LOCAL_DEFID);
     556                 :       12907 :   mappings->insert_node_to_hir (mapping.get_nodeid (), mapping.get_hirid ());
     557                 :             : 
     558                 :       12907 :   return HIR::LoopLabel (mapping, std::move (life), loop_label.get_locus ());
     559                 :       12907 : }
     560                 :             : 
     561                 :             : std::vector<std::unique_ptr<HIR::GenericParam>>
     562                 :        4428 : ASTLoweringBase::lower_generic_params (
     563                 :             :   std::vector<std::unique_ptr<AST::GenericParam>> &params)
     564                 :             : {
     565                 :        4428 :   std::vector<std::unique_ptr<HIR::GenericParam>> lowered;
     566                 :        9408 :   for (auto &ast_param : params)
     567                 :             :     {
     568                 :        4980 :       auto hir_param = ASTLowerGenericParam::translate (ast_param.get ());
     569                 :        4980 :       lowered.push_back (std::unique_ptr<HIR::GenericParam> (hir_param));
     570                 :             :     }
     571                 :             : 
     572                 :        4428 :   return lowered;
     573                 :             : }
     574                 :             : 
     575                 :             : HIR::PathExprSegment
     576                 :       14761 : ASTLoweringBase::lower_path_expr_seg (AST::PathExprSegment &s)
     577                 :             : {
     578                 :       14761 :   auto crate_num = mappings->get_current_crate ();
     579                 :       14761 :   Analysis::NodeMapping mapping (crate_num, s.get_node_id (),
     580                 :       14761 :                                  mappings->get_next_hir_id (crate_num),
     581                 :       14761 :                                  UNKNOWN_LOCAL_DEFID);
     582                 :             : 
     583                 :       14761 :   return HIR::PathExprSegment (
     584                 :             :     std::move (mapping),
     585                 :       29522 :     HIR::PathIdentSegment (s.get_ident_segment ().as_string ()), s.get_locus (),
     586                 :       29522 :     s.has_generic_args () ? lower_generic_args (s.get_generic_args ())
     587                 :       29522 :                           : HIR::GenericArgs::create_empty ());
     588                 :             : }
     589                 :             : 
     590                 :             : HIR::GenericArgsBinding
     591                 :          28 : ASTLoweringBase::lower_binding (AST::GenericArgsBinding &binding)
     592                 :             : {
     593                 :          28 :   HIR::Type *lowered_type
     594                 :          28 :     = ASTLoweringType::translate (binding.get_type ().get ());
     595                 :          28 :   return HIR::GenericArgsBinding (binding.get_identifier (),
     596                 :          56 :                                   std::unique_ptr<HIR::Type> (lowered_type),
     597                 :          56 :                                   binding.get_locus ());
     598                 :             : }
     599                 :             : 
     600                 :             : HIR::GenericArgs
     601                 :        1929 : ASTLoweringBase::lower_generic_args (AST::GenericArgs &args)
     602                 :             : {
     603                 :        1929 :   std::vector<HIR::GenericArgsBinding> binding_args;
     604                 :        1957 :   for (auto &binding : args.get_binding_args ())
     605                 :             :     {
     606                 :          28 :       HIR::GenericArgsBinding b = lower_binding (binding);
     607                 :          28 :       binding_args.push_back (std::move (b));
     608                 :          28 :     }
     609                 :             : 
     610                 :        1929 :   std::vector<HIR::Lifetime> lifetime_args;
     611                 :        1940 :   for (auto &lifetime : args.get_lifetime_args ())
     612                 :             :     {
     613                 :          11 :       HIR::Lifetime l = lower_lifetime (lifetime);
     614                 :          11 :       lifetime_args.push_back (std::move (l));
     615                 :          11 :     }
     616                 :             : 
     617                 :        1929 :   std::vector<std::unique_ptr<HIR::Type>> type_args;
     618                 :        1929 :   std::vector<HIR::ConstGenericArg> const_args;
     619                 :             : 
     620                 :        3990 :   for (auto &arg : args.get_generic_args ())
     621                 :             :     {
     622                 :        2061 :       switch (arg.get_kind ())
     623                 :             :         {
     624                 :        2057 :           case AST::GenericArg::Kind::Type: {
     625                 :        2057 :             auto type = ASTLoweringType::translate (arg.get_type ().get ());
     626                 :        2057 :             type_args.emplace_back (std::unique_ptr<HIR::Type> (type));
     627                 :        2057 :             break;
     628                 :             :           }
     629                 :           4 :           case AST::GenericArg::Kind::Const: {
     630                 :           4 :             auto expr
     631                 :           4 :               = ASTLoweringExpr::translate (arg.get_expression ().get ());
     632                 :           4 :             const_args.emplace_back (
     633                 :           8 :               HIR::ConstGenericArg (std::unique_ptr<HIR::Expr> (expr),
     634                 :           4 :                                     expr->get_locus ()));
     635                 :           4 :             break;
     636                 :             :           }
     637                 :           0 :         default:
     638                 :           0 :           rust_unreachable ();
     639                 :             :         }
     640                 :             :     }
     641                 :             : 
     642                 :        1929 :   return HIR::GenericArgs (std::move (lifetime_args), std::move (type_args),
     643                 :             :                            std::move (binding_args), std::move (const_args),
     644                 :        1929 :                            args.get_locus ());
     645                 :        1929 : }
     646                 :             : 
     647                 :             : HIR::SelfParam
     648                 :        3473 : ASTLoweringBase::lower_self (std::unique_ptr<AST::Param> &param)
     649                 :             : {
     650                 :        3473 :   rust_assert (param->is_self ());
     651                 :             : 
     652                 :        3473 :   auto self = static_cast<AST::SelfParam *> (param.get ());
     653                 :        3473 :   auto crate_num = mappings->get_current_crate ();
     654                 :        3473 :   Analysis::NodeMapping mapping (crate_num, self->get_node_id (),
     655                 :        3473 :                                  mappings->get_next_hir_id (crate_num),
     656                 :        3473 :                                  mappings->get_next_localdef_id (crate_num));
     657                 :             : 
     658                 :        3473 :   if (self->has_type ())
     659                 :             :     {
     660                 :           1 :       HIR::Type *type = ASTLoweringType::translate (self->get_type ().get ());
     661                 :           1 :       return HIR::SelfParam (mapping, std::unique_ptr<HIR::Type> (type),
     662                 :           1 :                              self->get_is_mut (), self->get_locus ());
     663                 :             :     }
     664                 :        3472 :   else if (!self->get_has_ref ())
     665                 :             :     {
     666                 :        1718 :       return HIR::SelfParam (mapping, std::unique_ptr<HIR::Type> (nullptr),
     667                 :        1718 :                              self->get_is_mut (), self->get_locus ());
     668                 :             :     }
     669                 :             : 
     670                 :        1754 :   AST::Lifetime l = self->get_lifetime ();
     671                 :        3508 :   return HIR::SelfParam (mapping, lower_lifetime (l), self->get_is_mut (),
     672                 :        3508 :                          self->get_locus ());
     673                 :        1754 : }
     674                 :             : 
     675                 :             : HIR::Type *
     676                 :        3283 : ASTLoweringBase::lower_type_no_bounds (AST::TypeNoBounds *type)
     677                 :             : {
     678                 :        3283 :   return ASTLoweringType::translate (type);
     679                 :             : }
     680                 :             : 
     681                 :             : HIR::TypeParamBound *
     682                 :         399 : ASTLoweringBase::lower_bound (AST::TypeParamBound *bound)
     683                 :             : {
     684                 :         399 :   return ASTLoweringTypeBounds::translate (bound);
     685                 :             : }
     686                 :             : 
     687                 :             : /* Checks whether the name of a field already exists.  Returns true
     688                 :             :    and produces an error if so.  */
     689                 :             : bool
     690                 :        1661 : struct_field_name_exists (std::vector<HIR::StructField> &fields,
     691                 :             :                           HIR::StructField &new_field)
     692                 :             : {
     693                 :        5313 :   for (auto &field : fields)
     694                 :             :     {
     695                 :        7316 :       if (field.get_field_name ().as_string ().compare (
     696                 :        3658 :             new_field.get_field_name ().as_string ())
     697                 :        3658 :           == 0)
     698                 :             :         {
     699                 :           6 :           rich_location r (line_table, new_field.get_locus ());
     700                 :           6 :           r.add_range (field.get_locus ());
     701                 :           6 :           rust_error_at (r, ErrorCode::E0124, "field %qs is already declared",
     702                 :           6 :                          field.get_field_name ().as_string ().c_str ());
     703                 :           6 :           return true;
     704                 :           6 :         }
     705                 :             :     }
     706                 :             :   return false;
     707                 :             : }
     708                 :             : 
     709                 :             : HIR::FunctionQualifiers
     710                 :        9405 : ASTLoweringBase::lower_qualifiers (const AST::FunctionQualifiers &qualifiers)
     711                 :             : {
     712                 :        9405 :   Unsafety unsafety
     713                 :        9405 :     = qualifiers.is_unsafe () ? Unsafety::Unsafe : Unsafety::Normal;
     714                 :        9405 :   bool has_extern = qualifiers.is_extern ();
     715                 :        9405 :   ABI abi = has_extern ? ABI::C : ABI::RUST;
     716                 :             : 
     717                 :        9405 :   if (qualifiers.has_abi ())
     718                 :             :     {
     719                 :          50 :       const std::string &extern_abi = qualifiers.get_extern_abi ();
     720                 :          50 :       abi = get_abi_from_string (extern_abi);
     721                 :          50 :       if (has_extern && abi == ABI::UNKNOWN)
     722                 :           1 :         rust_error_at (qualifiers.get_locus (), ErrorCode::E0703,
     723                 :             :                        "invalid ABI: found %qs", extern_abi.c_str ());
     724                 :          50 :     }
     725                 :             : 
     726                 :        9405 :   return HIR::FunctionQualifiers (qualifiers.get_async_status (),
     727                 :             :                                   qualifiers.get_const_status (), unsafety,
     728                 :        9405 :                                   has_extern, abi);
     729                 :             : }
     730                 :             : 
     731                 :             : void
     732                 :       19587 : ASTLoweringBase::handle_outer_attributes (const ItemWrapper &item)
     733                 :             : {
     734                 :       21826 :   for (const auto &attr : item.get_outer_attrs ())
     735                 :             :     {
     736                 :        2239 :       const auto &str_path = attr.get_path ().as_string ();
     737                 :        2239 :       if (!is_known_attribute (str_path))
     738                 :             :         {
     739                 :           0 :           rust_error_at (attr.get_locus (), "unknown attribute");
     740                 :           0 :           continue;
     741                 :             :         }
     742                 :             : 
     743                 :        2239 :       bool is_lang_item = str_path == Values::Attributes::LANG
     744                 :        1779 :                           && attr.has_attr_input ()
     745                 :        4018 :                           && attr.get_attr_input ().get_attr_input_type ()
     746                 :        2239 :                                == AST::AttrInput::AttrInputType::LITERAL;
     747                 :             : 
     748                 :        2239 :       bool is_doc_item = str_path == Values::Attributes::DOC;
     749                 :             : 
     750                 :        2239 :       if (is_doc_item)
     751                 :         222 :         handle_doc_item_attribute (item, attr);
     752                 :        2017 :       else if (is_lang_item)
     753                 :        1779 :         handle_lang_item_attribute (item, attr);
     754                 :         238 :       else if (!attribute_handled_in_another_pass (str_path))
     755                 :             :         {
     756                 :           0 :           rust_error_at (attr.get_locus (), "unhandled attribute: [%s]",
     757                 :           0 :                          attr.get_path ().as_string ().c_str ());
     758                 :             :         }
     759                 :        2239 :     }
     760                 :       19587 : }
     761                 :             : 
     762                 :             : void
     763                 :         222 : ASTLoweringBase::handle_doc_item_attribute (const ItemWrapper &,
     764                 :             :                                             const AST::Attribute &attr)
     765                 :             : {
     766                 :         222 :   auto simple_doc_comment = attr.has_attr_input ()
     767                 :         222 :                             && attr.get_attr_input ().get_attr_input_type ()
     768                 :         236 :                                  == AST::AttrInput::AttrInputType::LITERAL;
     769                 :          14 :   if (simple_doc_comment)
     770                 :             :     return;
     771                 :             : 
     772                 :          14 :   const AST::AttrInput &input = attr.get_attr_input ();
     773                 :          14 :   bool is_token_tree
     774                 :          14 :     = input.get_attr_input_type () == AST::AttrInput::AttrInputType::TOKEN_TREE;
     775                 :          14 :   rust_assert (is_token_tree);
     776                 :          14 :   const auto &option = static_cast<const AST::DelimTokenTree &> (input);
     777                 :          14 :   AST::AttrInputMetaItemContainer *meta_item = option.parse_to_meta_item ();
     778                 :             : 
     779                 :             :   // TODO: add actual and complete checks for the doc attributes
     780                 :             :   //
     781                 :             :   // FIXME: Move this to the AttributeChecker visitor
     782                 :          14 :   rust_assert (meta_item);
     783                 :             : }
     784                 :             : 
     785                 :             : void
     786                 :        1779 : ASTLoweringBase::handle_lang_item_attribute (const ItemWrapper &item,
     787                 :             :                                              const AST::Attribute &attr)
     788                 :             : {
     789                 :        1779 :   auto &literal = static_cast<AST::AttrInputLiteral &> (attr.get_attr_input ());
     790                 :        1779 :   const auto &lang_item_type_str = literal.get_literal ().as_string ();
     791                 :        1779 :   auto lang_item_type = Analysis::RustLangItem::Parse (lang_item_type_str);
     792                 :        1779 :   if (lang_item_type == Analysis::RustLangItem::ItemType::UNKNOWN)
     793                 :             :     {
     794                 :           0 :       rust_error_at (attr.get_locus (), "unknown lang item");
     795                 :           0 :       return;
     796                 :             :     }
     797                 :        1779 :   mappings->insert_lang_item (lang_item_type,
     798                 :        1779 :                               item.get_mappings ().get_defid ());
     799                 :        1779 : }
     800                 :             : 
     801                 :             : bool
     802                 :        2239 : ASTLoweringBase::is_known_attribute (const std::string &attribute_path) const
     803                 :             : {
     804                 :        2239 :   const auto &lookup = attr_mappings->lookup_builtin (attribute_path);
     805                 :        2239 :   return !lookup.is_error ();
     806                 :             : }
     807                 :             : 
     808                 :             : bool
     809                 :         238 : ASTLoweringBase::attribute_handled_in_another_pass (
     810                 :             :   const std::string &attribute_path) const
     811                 :             : {
     812                 :         238 :   const auto &lookup = attr_mappings->lookup_builtin (attribute_path);
     813                 :         238 :   if (lookup.is_error ())
     814                 :             :     return false;
     815                 :             : 
     816                 :         238 :   if (lookup.handler == Analysis::CompilerPass::UNKNOWN)
     817                 :             :     return false;
     818                 :             : 
     819                 :         238 :   return lookup.handler != Analysis::CompilerPass::HIR_LOWERING;
     820                 :             : }
     821                 :             : 
     822                 :             : std::unique_ptr<HIR::TuplePatternItems>
     823                 :         147 : ASTLoweringBase::lower_tuple_pattern_multiple (
     824                 :             :   AST::TuplePatternItemsMultiple &pattern)
     825                 :             : {
     826                 :         147 :   std::vector<std::unique_ptr<HIR::Pattern>> patterns;
     827                 :         444 :   for (auto &p : pattern.get_patterns ())
     828                 :             :     {
     829                 :         297 :       HIR::Pattern *translated = ASTLoweringPattern::translate (p.get ());
     830                 :         297 :       patterns.push_back (std::unique_ptr<HIR::Pattern> (translated));
     831                 :             :     }
     832                 :             : 
     833                 :         147 :   return std::unique_ptr<HIR::TuplePatternItems> (
     834                 :         147 :     new HIR::TuplePatternItemsMultiple (std::move (patterns)));
     835                 :         147 : }
     836                 :             : 
     837                 :             : std::unique_ptr<TuplePatternItems>
     838                 :           0 : ASTLoweringBase::lower_tuple_pattern_ranged (
     839                 :             :   AST::TuplePatternItemsRanged &pattern)
     840                 :             : {
     841                 :           0 :   std::vector<std::unique_ptr<HIR::Pattern>> lower_patterns;
     842                 :           0 :   std::vector<std::unique_ptr<HIR::Pattern>> upper_patterns;
     843                 :             : 
     844                 :           0 :   for (auto &p : pattern.get_lower_patterns ())
     845                 :             :     {
     846                 :           0 :       HIR::Pattern *translated = ASTLoweringPattern::translate (p.get ());
     847                 :           0 :       lower_patterns.push_back (std::unique_ptr<HIR::Pattern> (translated));
     848                 :             :     }
     849                 :             : 
     850                 :           0 :   for (auto &p : pattern.get_upper_patterns ())
     851                 :             :     {
     852                 :           0 :       HIR::Pattern *translated = ASTLoweringPattern::translate (p.get ());
     853                 :           0 :       upper_patterns.push_back (std::unique_ptr<HIR::Pattern> (translated));
     854                 :             :     }
     855                 :             : 
     856                 :           0 :   return std::unique_ptr<HIR::TuplePatternItems> (
     857                 :             :     new HIR::TuplePatternItemsRanged (std::move (lower_patterns),
     858                 :           0 :                                       std::move (upper_patterns)));
     859                 :           0 : }
     860                 :             : 
     861                 :             : std::unique_ptr<HIR::RangePatternBound>
     862                 :          42 : ASTLoweringBase::lower_range_pattern_bound (AST::RangePatternBound *bound)
     863                 :             : {
     864                 :          42 :   std::unique_ptr<HIR::RangePatternBound> hir_bound = nullptr;
     865                 :          42 :   switch (bound->get_bound_type ())
     866                 :             :     {
     867                 :          21 :       case AST::RangePatternBound::RangePatternBoundType::LITERAL: {
     868                 :          21 :         AST::RangePatternBoundLiteral &ref
     869                 :             :           = *static_cast<AST::RangePatternBoundLiteral *> (bound);
     870                 :             : 
     871                 :          21 :         HIR::Literal literal = lower_literal (ref.get_literal ());
     872                 :             : 
     873                 :          42 :         hir_bound = std::unique_ptr<HIR::RangePatternBound> (
     874                 :             :           new HIR::RangePatternBoundLiteral (literal, ref.get_locus (),
     875                 :          42 :                                              ref.get_has_minus ()));
     876                 :          21 :       }
     877                 :          21 :       break;
     878                 :          21 :       case AST::RangePatternBound::RangePatternBoundType::PATH: {
     879                 :          21 :         AST::RangePatternBoundPath &ref
     880                 :             :           = *static_cast<AST::RangePatternBoundPath *> (bound);
     881                 :             : 
     882                 :          21 :         HIR::PathInExpression *path
     883                 :          21 :           = ASTLowerPathInExpression::translate (&ref.get_path ());
     884                 :             : 
     885                 :          21 :         hir_bound = std::unique_ptr<HIR::RangePatternBound> (
     886                 :          21 :           new HIR::RangePatternBoundPath (*path));
     887                 :             :       }
     888                 :          21 :       break;
     889                 :           0 :       case AST::RangePatternBound::RangePatternBoundType::QUALPATH: {
     890                 :           0 :         AST::RangePatternBoundQualPath &ref
     891                 :             :           = *static_cast<AST::RangePatternBoundQualPath *> (bound);
     892                 :             : 
     893                 :           0 :         HIR::QualifiedPathInExpression *qualpath
     894                 :           0 :           = ASTLowerQualPathInExpression::translate (
     895                 :           0 :             &ref.get_qualified_path ());
     896                 :             : 
     897                 :           0 :         hir_bound = std::unique_ptr<HIR::RangePatternBound> (
     898                 :           0 :           new HIR::RangePatternBoundQualPath (*qualpath));
     899                 :             :       }
     900                 :           0 :       break;
     901                 :             :     }
     902                 :             : 
     903                 :          42 :   return hir_bound;
     904                 :             : }
     905                 :             : 
     906                 :             : HIR::Literal
     907                 :       13194 : ASTLoweringBase::lower_literal (const AST::Literal &literal)
     908                 :             : {
     909                 :       13194 :   HIR::Literal::LitType type = HIR::Literal::LitType::CHAR;
     910                 :       13194 :   switch (literal.get_lit_type ())
     911                 :             :     {
     912                 :             :     case AST::Literal::LitType::CHAR:
     913                 :             :       type = HIR::Literal::LitType::CHAR;
     914                 :             :       break;
     915                 :        1371 :     case AST::Literal::LitType::STRING:
     916                 :        1371 :       type = HIR::Literal::LitType::STRING;
     917                 :        1371 :       break;
     918                 :         184 :     case AST::Literal::LitType::BYTE:
     919                 :         184 :       type = HIR::Literal::LitType::BYTE;
     920                 :         184 :       break;
     921                 :          28 :     case AST::Literal::LitType::BYTE_STRING:
     922                 :          28 :       type = HIR::Literal::LitType::BYTE_STRING;
     923                 :          28 :       break;
     924                 :       10454 :     case AST::Literal::LitType::INT:
     925                 :       10454 :       type = HIR::Literal::LitType::INT;
     926                 :       10454 :       break;
     927                 :         314 :     case AST::Literal::LitType::FLOAT:
     928                 :         314 :       type = HIR::Literal::LitType::FLOAT;
     929                 :         314 :       break;
     930                 :         657 :     case AST::Literal::LitType::BOOL:
     931                 :         657 :       type = HIR::Literal::LitType::BOOL;
     932                 :         657 :       break;
     933                 :           0 :     case AST::Literal::LitType::ERROR:
     934                 :           0 :       rust_unreachable ();
     935                 :       13194 :       break;
     936                 :             :     }
     937                 :             : 
     938                 :       13194 :   return HIR::Literal (literal.as_string (), type, literal.get_type_hint ());
     939                 :             : }
     940                 :             : 
     941                 :             : HIR::ExternBlock *
     942                 :        1024 : ASTLoweringBase::lower_extern_block (AST::ExternBlock &extern_block)
     943                 :             : {
     944                 :        1024 :   HIR::Visibility vis = translate_visibility (extern_block.get_visibility ());
     945                 :             : 
     946                 :        1024 :   auto crate_num = mappings->get_current_crate ();
     947                 :        1024 :   Analysis::NodeMapping mapping (crate_num, extern_block.get_node_id (),
     948                 :        1024 :                                  mappings->get_next_hir_id (crate_num),
     949                 :        1024 :                                  mappings->get_next_localdef_id (crate_num));
     950                 :             : 
     951                 :        1024 :   std::vector<std::unique_ptr<HIR::ExternalItem>> extern_items;
     952                 :        2616 :   for (auto &item : extern_block.get_extern_items ())
     953                 :             :     {
     954                 :        1592 :       if (item->is_marked_for_strip ())
     955                 :           0 :         continue;
     956                 :             : 
     957                 :        1592 :       HIR::ExternalItem *lowered
     958                 :        1592 :         = ASTLoweringExternItem::translate (item.get (), mapping.get_hirid ());
     959                 :        1592 :       extern_items.push_back (std::unique_ptr<HIR::ExternalItem> (lowered));
     960                 :             :     }
     961                 :             : 
     962                 :        1024 :   ABI abi = ABI::C;
     963                 :        1024 :   if (extern_block.has_abi ())
     964                 :             :     {
     965                 :        1024 :       const std::string &extern_abi = extern_block.get_abi ();
     966                 :        1024 :       abi = get_abi_from_string (extern_abi);
     967                 :        1024 :       if (abi == ABI::UNKNOWN)
     968                 :           1 :         rust_error_at (extern_block.get_locus (), ErrorCode::E0703,
     969                 :             :                        "invalid ABI: found %qs", extern_abi.c_str ());
     970                 :        1024 :     }
     971                 :             : 
     972                 :        1024 :   HIR::ExternBlock *hir_extern_block
     973                 :             :     = new HIR::ExternBlock (mapping, abi, std::move (extern_items),
     974                 :        1024 :                             std::move (vis), extern_block.get_inner_attrs (),
     975                 :        1024 :                             extern_block.get_outer_attrs (),
     976                 :        1024 :                             extern_block.get_locus ());
     977                 :             : 
     978                 :        1024 :   mappings->insert_hir_extern_block (hir_extern_block);
     979                 :             : 
     980                 :        2048 :   return hir_extern_block;
     981                 :        1024 : }
     982                 :             : 
     983                 :             : void
     984                 :         595 : ASTLoweringBase::lower_macro_definition (AST::MacroRulesDefinition &def)
     985                 :             : {
     986                 :         595 :   auto is_export = false;
     987                 :         690 :   for (const auto &attr : def.get_outer_attrs ())
     988                 :          95 :     if (attr.get_path ().as_string () == Values::Attributes::MACRO_EXPORT)
     989                 :           1 :       is_export = true;
     990                 :             : 
     991                 :         595 :   if (is_export)
     992                 :             :     {
     993                 :           1 :       mappings->insert_exported_macro (def);
     994                 :           1 :       mappings->insert_ast_item (&def);
     995                 :           1 :       mappings->insert_location (def.get_node_id (), def.get_locus ());
     996                 :             :     }
     997                 :         595 : }
     998                 :             : 
     999                 :             : } // namespace HIR
    1000                 :             : } // namespace Rust
        

Generated by: LCOV version 2.1-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.