Ignore:
Timestamp:
Nov 17, 2023, 10:40:21 AM (9 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
0f6d2884
Parents:
e580aa5
Message:

Reformating and clean-up in SymTab? directory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/FixFunction.cc

    re580aa5 rb0845f9  
    2626
    2727namespace {
    28         struct FixFunction final : public ast::WithShortCircuiting {
    29                 bool isVoid = false;
    3028
    31                 void previsit( const ast::FunctionDecl * ) { visit_children = false; }
     29struct FixFunction final : public ast::WithShortCircuiting {
     30        bool isVoid = false;
    3231
    33                 const ast::DeclWithType * postvisit( const ast::FunctionDecl * func ) {
    34                         // Cannot handle cases with asserions.
    35                         assert( func->assertions.empty() );
    36                         return new ast::ObjectDecl{
    37                                 func->location, func->name, new ast::PointerType( func->type ), nullptr,
    38                                 func->storage, func->linkage, nullptr, copy( func->attributes ) };
    39                 }
     32        void previsit( const ast::FunctionDecl * ) { visit_children = false; }
    4033
    41                 void previsit( const ast::ArrayType * ) { visit_children = false; }
     34        const ast::DeclWithType * postvisit( const ast::FunctionDecl * func ) {
     35                // Cannot handle cases with asserions.
     36                assert( func->assertions.empty() );
     37                return new ast::ObjectDecl{
     38                        func->location, func->name, new ast::PointerType( func->type ), nullptr,
     39                        func->storage, func->linkage, nullptr, copy( func->attributes ) };
     40        }
    4241
    43                 const ast::Type * postvisit( const ast::ArrayType * array ) {
    44                         return new ast::PointerType{
    45                                 array->base, array->dimension, array->isVarLen, array->isStatic,
    46                                 array->qualifiers };
    47                 }
     42        void previsit( const ast::ArrayType * ) { visit_children = false; }
    4843
    49                 void previsit( const ast::FunctionType * ) { visit_children = false; }
     44        const ast::Type * postvisit( const ast::ArrayType * array ) {
     45                return new ast::PointerType{
     46                        array->base, array->dimension, array->isVarLen, array->isStatic,
     47                        array->qualifiers };
     48        }
    5049
    51                 const ast::Type * postvisit( const ast::FunctionType * type ) {
    52                         return new ast::PointerType( type );
    53                 }
     50        void previsit( const ast::FunctionType * ) { visit_children = false; }
    5451
    55                 void previsit( const ast::VoidType * ) { isVoid = true; }
     52        const ast::Type * postvisit( const ast::FunctionType * type ) {
     53                return new ast::PointerType( type );
     54        }
    5655
    57                 void previsit( const ast::BasicType * ) { visit_children = false; }
    58                 void previsit( const ast::PointerType * ) { visit_children = false; }
    59                 void previsit( const ast::StructInstType * ) { visit_children = false; }
    60                 void previsit( const ast::UnionInstType * ) { visit_children = false; }
    61                 void previsit( const ast::EnumInstType * ) { visit_children = false; }
    62                 void previsit( const ast::TraitInstType * ) { visit_children = false; }
    63                 void previsit( const ast::TypeInstType * ) { visit_children = false; }
    64                 void previsit( const ast::TupleType * ) { visit_children = false; }
    65                 void previsit( const ast::VarArgsType * ) { visit_children = false; }
    66                 void previsit( const ast::ZeroType * ) { visit_children = false; }
    67                 void previsit( const ast::OneType * ) { visit_children = false; }
    68         };
     56        void previsit( const ast::VoidType * ) { isVoid = true; }
     57
     58        void previsit( const ast::BasicType * ) { visit_children = false; }
     59        void previsit( const ast::PointerType * ) { visit_children = false; }
     60        void previsit( const ast::StructInstType * ) { visit_children = false; }
     61        void previsit( const ast::UnionInstType * ) { visit_children = false; }
     62        void previsit( const ast::EnumInstType * ) { visit_children = false; }
     63        void previsit( const ast::TraitInstType * ) { visit_children = false; }
     64        void previsit( const ast::TypeInstType * ) { visit_children = false; }
     65        void previsit( const ast::TupleType * ) { visit_children = false; }
     66        void previsit( const ast::VarArgsType * ) { visit_children = false; }
     67        void previsit( const ast::ZeroType * ) { visit_children = false; }
     68        void previsit( const ast::OneType * ) { visit_children = false; }
     69};
     70
    6971} // anonymous namespace
    7072
Note: See TracChangeset for help on using the changeset viewer.