Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Print.cpp

    r5902625 r76ed81f  
    2222#include "TypeSubstitution.hpp"
    2323
    24 using namespace std;
    2524
    2625namespace ast {
     
    2827template <typename C, typename... T>
    2928constexpr auto make_array(T&&... values) ->
    30         array<C,sizeof...(T)>
     29        std::array<C,sizeof...(T)>
    3130{
    32         return array<C,sizeof...(T)>{
    33                 forward<T>(values)...
     31        return std::array<C,sizeof...(T)>{
     32                std::forward<T>(values)...
    3433        };
    3534}
     
    3736class Printer : public Visitor {
    3837public:
    39         ostream & os;
     38        std::ostream & os;
    4039        Indenter indent;
    41         bool short_mode;
    42 
    43         Printer(ostream & os, Indenter indent, bool short_mode) : os( os ), indent( indent ), short_mode(short_mode) {}
     40
     41        Printer(std::ostream & os, Indenter indent) : os( os ), indent( indent ) {}
    4442
    4543private:
     
    5250                                // need an endl after each element because it's not
    5351                                // easy to know when each individual item should end
    54                                 os << endl;
     52                                os << std::endl;
    5553                        } // if
    5654                } // for
     
    7573
    7674        template<typename storage_t, size_t N>
    77         void print(const storage_t & storage, const array<const char *, N> & Names ) {
     75        void print(const storage_t & storage, const std::array<const char *, N> & Names ) {
    7876                if ( storage.any() ) {
    7977                        for ( size_t i = 0; i < Names.size(); i += 1 ) {
     
    9795        }
    9896
    99         void print( const ast::AggregateDecl * node ) {
    100                 os << node->typeString() << " " << node->name << ":";
    101                 if ( node->linkage != Linkage::Cforall ) {
    102                         os << " " << Linkage::name( node->linkage );
    103                 } // if
    104                 os << " with body : " << (node->body ? "yes " : "no ");
    105 
    106                 if ( ! node->params.empty() ) {
    107                         os << endl << indent << "... with parameters" << endl;
    108                         ++indent;
    109                         printAll( node->params );
    110                         --indent;
    111                 } // if
    112                 if ( ! node->members.empty() ) {
    113                         os << endl << indent << "... with members" << endl;
    114                         ++indent;
    115                         printAll( node->members );
    116                         --indent;
    117                 } // if
    118                 if ( ! node->attributes.empty() ) {
    119                         os << endl << indent << "... with attributes" << endl;
    120                         ++indent;
    121                         printAll( node->attributes );
    122                         --indent;
    123                 } // if
    124                 os << endl;
    125         }
    126 
    127         void print( const ast::NamedTypeDecl * node ) {
    128                 if ( !node->name.empty() ) os << node->name << ": ";
    129 
    130                 if ( node->linkage != Linkage::Cforall ) {
    131                         os << Linkage::name( node->linkage ) << " ";
    132                 } // if
    133                 print( node->storage );
    134                 os << node->typeString();
    135                 if ( node->base ) {
    136                         os << " for ";
    137                         ++indent;
    138                         node->base->accept( *this );
    139                         --indent;
    140                 } // if
    141                 if ( ! node->params.empty() ) {
    142                         os << endl << indent << "... with parameters" << endl;
    143                         ++indent;
    144                         printAll( node->params );
    145                         --indent;
    146                 } // if
    147                 if ( ! node->assertions.empty() ) {
    148                         os << endl << indent << "... with assertions" << endl;
    149                         ++indent;
    150                         printAll( node->assertions );
    151                         --indent;
    152                 } // if
    153         }
    154 
    15597public:
    156         virtual const ast::DeclWithType * visit( const ast::ObjectDecl * node ) {
    157                 if (  !node->name.empty() ) os << node->name << ": ";
     98        virtual const ast::DeclWithType *     visit( const ast::ObjectDecl          * node ) {
     99                if ( node->name != "" ) os << node->name << ": ";
    158100
    159101                if ( node->linkage != Linkage::Cforall ) {
     
    174116                                        ? "maybe constructed"
    175117                                        : "not constructed"
    176                                 ) << ")" << endl << indent+1;
     118                                ) << ")" << std::endl << indent+1;
    177119
    178120                        ++indent;
    179121                        node->init->accept( *this );
    180122                        --indent;
    181                         os << endl;
     123                        os << std::endl;
    182124                } // if
    183125
    184126                if ( ! node->attributes.empty() ) {
    185                         os << endl << indent << "... with attributes:" << endl;
     127                        os << std::endl << indent << "... with attributes:" << std::endl;
    186128                        ++indent;
    187129                        printAll( node->attributes );
     
    196138        }
    197139
    198         virtual const ast::DeclWithType * visit( const ast::FunctionDecl * node ) {
    199                 if ( !node->name.empty() ) {
    200                         os << node->name << ": ";
    201                 } // if
    202                 if ( node->linkage != Linkage::Cforall ) {
    203                         os << Linkage::name( node->linkage ) << " ";
    204                 } // if
    205 
    206                 printAll( node->attributes );
    207 
    208                 print( node->storage );
    209                 print( node->funcSpec );
    210 
    211                 if ( node->type ) {
    212                         node->type->accept( *this );
    213                 } else {
    214                         os << "untyped entity ";
    215                 } // if
    216 
    217                 if ( node->stmts ) {
    218                         os << indent << "... with body" << endl << indent+1;
    219                         ++indent;
    220                         node->stmts->accept( *this );
    221                         --indent;
    222                 } // if
    223                 return node;
    224         }
    225 
    226         virtual const ast::Decl * visit( const ast::StructDecl * node ) {
    227                 print(node);
    228                 return node;
    229         }
    230 
    231         virtual const ast::Decl * visit( const ast::UnionDecl * node ) {
    232                 print(node);
    233                 return node;
    234         }
    235 
    236         virtual const ast::Decl * visit( const ast::EnumDecl * node ) {
    237                 print(node);
    238                 return node;
    239         }
    240 
    241         virtual const ast::Decl * visit( const ast::TraitDecl * node ) {
    242                 print(node);
    243                 return node;
    244         }
    245 
    246         virtual const ast::Decl * visit( const ast::TypeDecl * node ) {
    247                 print( node );
    248                 if ( node->init ) {
    249                         os << endl << indent << "with type initializer: ";
    250                         ++indent;
    251                         node->init->accept( *this );
    252                         --indent;
     140        virtual const ast::DeclWithType *     visit( const ast::FunctionDecl         * node ) {
     141                return node;
     142        }
     143
     144        virtual const ast::Decl *             visit( const ast::StructDecl           * node ) {
     145                return node;
     146        }
     147
     148        virtual const ast::Decl *             visit( const ast::UnionDecl            * node ) {
     149                return node;
     150        }
     151
     152        virtual const ast::Decl *             visit( const ast::EnumDecl             * node ) {
     153                return node;
     154        }
     155
     156        virtual const ast::Decl *             visit( const ast::TraitDecl            * node ) {
     157                return node;
     158        }
     159
     160        virtual const ast::Decl *             visit( const ast::TypeDecl             * node ) {
     161                return node;
     162        }
     163
     164        virtual const ast::Decl *             visit( const ast::TypedefDecl          * node ) {
     165                return node;
     166        }
     167
     168        virtual const ast::AsmDecl *          visit( const ast::AsmDecl              * node ) {
     169                return node;
     170        }
     171
     172        virtual const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl     * node ) {
     173                return node;
     174        }
     175
     176        virtual const ast::CompoundStmt *     visit( const ast::CompoundStmt         * node ) {
     177                return node;
     178        }
     179
     180        virtual const ast::Stmt *             visit( const ast::ExprStmt             * node ) {
     181                return node;
     182        }
     183
     184        virtual const ast::Stmt *             visit( const ast::AsmStmt              * node ) {
     185                return node;
     186        }
     187
     188        virtual const ast::Stmt *             visit( const ast::DirectiveStmt        * node ) {
     189                return node;
     190        }
     191
     192        virtual const ast::Stmt *             visit( const ast::IfStmt               * node ) {
     193                return node;
     194        }
     195
     196        virtual const ast::Stmt *             visit( const ast::WhileStmt            * node ) {
     197                return node;
     198        }
     199
     200        virtual const ast::Stmt *             visit( const ast::ForStmt              * node ) {
     201                return node;
     202        }
     203
     204        virtual const ast::Stmt *             visit( const ast::SwitchStmt           * node ) {
     205                return node;
     206        }
     207
     208        virtual const ast::Stmt *             visit( const ast::CaseStmt             * node ) {
     209                return node;
     210        }
     211
     212        virtual const ast::Stmt *             visit( const ast::BranchStmt           * node ) {
     213                return node;
     214        }
     215
     216        virtual const ast::Stmt *             visit( const ast::ReturnStmt           * node ) {
     217                return node;
     218        }
     219
     220        virtual const ast::Stmt *             visit( const ast::ThrowStmt            * node ) {
     221                return node;
     222        }
     223
     224        virtual const ast::Stmt *             visit( const ast::TryStmt              * node ) {
     225                return node;
     226        }
     227
     228        virtual const ast::Stmt *             visit( const ast::CatchStmt            * node ) {
     229                return node;
     230        }
     231
     232        virtual const ast::Stmt *             visit( const ast::FinallyStmt          * node ) {
     233                return node;
     234        }
     235
     236        virtual const ast::Stmt *             visit( const ast::WaitForStmt          * node ) {
     237                return node;
     238        }
     239
     240        virtual const ast::Stmt *             visit( const ast::WithStmt             * node ) {
     241                return node;
     242        }
     243
     244        virtual const ast::NullStmt *         visit( const ast::NullStmt             * node ) {
     245                return node;
     246        }
     247
     248        virtual const ast::Stmt *             visit( const ast::DeclStmt             * node ) {
     249                return node;
     250        }
     251
     252        virtual const ast::Stmt *             visit( const ast::ImplicitCtorDtorStmt * node ) {
     253                return node;
     254        }
     255
     256        virtual const ast::Expr *             visit( const ast::ApplicationExpr      * node ) {
     257                return node;
     258        }
     259
     260        virtual const ast::Expr *             visit( const ast::UntypedExpr          * node ) {
     261                return node;
     262        }
     263
     264        virtual const ast::Expr *             visit( const ast::NameExpr             * node ) {
     265                return node;
     266        }
     267
     268        virtual const ast::Expr *             visit( const ast::AddressExpr          * node ) {
     269                return node;
     270        }
     271
     272        virtual const ast::Expr *             visit( const ast::LabelAddressExpr     * node ) {
     273                return node;
     274        }
     275
     276        virtual const ast::Expr *             visit( const ast::CastExpr             * node ) {
     277                return node;
     278        }
     279
     280        virtual const ast::Expr *             visit( const ast::KeywordCastExpr      * node ) {
     281                return node;
     282        }
     283
     284        virtual const ast::Expr *             visit( const ast::VirtualCastExpr      * node ) {
     285                return node;
     286        }
     287
     288        virtual const ast::Expr *             visit( const ast::UntypedMemberExpr    * node ) {
     289                return node;
     290        }
     291
     292        virtual const ast::Expr *             visit( const ast::MemberExpr           * node ) {
     293                return node;
     294        }
     295
     296        virtual const ast::Expr *             visit( const ast::VariableExpr         * node ) {
     297                return node;
     298        }
     299
     300        virtual const ast::Expr *             visit( const ast::ConstantExpr         * node ) {
     301                return node;
     302        }
     303
     304        virtual const ast::Expr *             visit( const ast::SizeofExpr           * node ) {
     305                return node;
     306        }
     307
     308        virtual const ast::Expr *             visit( const ast::AlignofExpr          * node ) {
     309                return node;
     310        }
     311
     312        virtual const ast::Expr *             visit( const ast::UntypedOffsetofExpr  * node ) {
     313                return node;
     314        }
     315
     316        virtual const ast::Expr *             visit( const ast::OffsetofExpr         * node ) {
     317                return node;
     318        }
     319
     320        virtual const ast::Expr *             visit( const ast::OffsetPackExpr       * node ) {
     321                return node;
     322        }
     323
     324        virtual const ast::Expr *             visit( const ast::LogicalExpr          * node ) {
     325                return node;
     326        }
     327
     328        virtual const ast::Expr *             visit( const ast::ConditionalExpr      * node ) {
     329                return node;
     330        }
     331
     332        virtual const ast::Expr *             visit( const ast::CommaExpr            * node ) {
     333                return node;
     334        }
     335
     336        virtual const ast::Expr *             visit( const ast::TypeExpr             * node ) {
     337                return node;
     338        }
     339
     340        virtual const ast::Expr *             visit( const ast::AsmExpr              * node ) {
     341                return node;
     342        }
     343
     344        virtual const ast::Expr *             visit( const ast::ImplicitCopyCtorExpr * node ) {
     345                return node;
     346        }
     347
     348        virtual const ast::Expr *             visit( const ast::ConstructorExpr      * node ) {
     349                return node;
     350        }
     351
     352        virtual const ast::Expr *             visit( const ast::CompoundLiteralExpr  * node ) {
     353                return node;
     354        }
     355
     356        virtual const ast::Expr *             visit( const ast::RangeExpr            * node ) {
     357                return node;
     358        }
     359
     360        virtual const ast::Expr *             visit( const ast::UntypedTupleExpr     * node ) {
     361                return node;
     362        }
     363
     364        virtual const ast::Expr *             visit( const ast::TupleExpr            * node ) {
     365                return node;
     366        }
     367
     368        virtual const ast::Expr *             visit( const ast::TupleIndexExpr       * node ) {
     369                return node;
     370        }
     371
     372        virtual const ast::Expr *             visit( const ast::TupleAssignExpr      * node ) {
     373                return node;
     374        }
     375
     376        virtual const ast::Expr *             visit( const ast::StmtExpr             * node ) {
     377                return node;
     378        }
     379
     380        virtual const ast::Expr *             visit( const ast::UniqueExpr           * node ) {
     381                return node;
     382        }
     383
     384        virtual const ast::Expr *             visit( const ast::UntypedInitExpr      * node ) {
     385                return node;
     386        }
     387
     388        virtual const ast::Expr *             visit( const ast::InitExpr             * node ) {
     389                return node;
     390        }
     391
     392        virtual const ast::Expr *             visit( const ast::DeletedExpr          * node ) {
     393                return node;
     394        }
     395
     396        virtual const ast::Expr *             visit( const ast::DefaultArgExpr       * node ) {
     397                return node;
     398        }
     399
     400        virtual const ast::Expr *             visit( const ast::GenericExpr          * node ) {
     401                return node;
     402        }
     403
     404        virtual const ast::Type *             visit( const ast::VoidType             * node ) {
     405                return node;
     406        }
     407
     408        virtual const ast::Type *             visit( const ast::BasicType            * node ) {
     409                return node;
     410        }
     411
     412        virtual const ast::Type *             visit( const ast::PointerType          * node ) {
     413                return node;
     414        }
     415
     416        virtual const ast::Type *             visit( const ast::ArrayType            * node ) {
     417                return node;
     418        }
     419
     420        virtual const ast::Type *             visit( const ast::ReferenceType        * node ) {
     421                return node;
     422        }
     423
     424        virtual const ast::Type *             visit( const ast::QualifiedType        * node ) {
     425                return node;
     426        }
     427
     428        virtual const ast::Type *             visit( const ast::FunctionType         * node ) {
     429                return node;
     430        }
     431
     432        virtual const ast::Type *             visit( const ast::StructInstType       * node ) {
     433                return node;
     434        }
     435
     436        virtual const ast::Type *             visit( const ast::UnionInstType        * node ) {
     437                return node;
     438        }
     439
     440        virtual const ast::Type *             visit( const ast::EnumInstType         * node ) {
     441                return node;
     442        }
     443
     444        virtual const ast::Type *             visit( const ast::TraitInstType        * node ) {
     445                return node;
     446        }
     447
     448        virtual const ast::Type *             visit( const ast::TypeInstType         * node ) {
     449                return node;
     450        }
     451
     452        virtual const ast::Type *             visit( const ast::TupleType            * node ) {
     453                return node;
     454        }
     455
     456        virtual const ast::Type *             visit( const ast::TypeofType           * node ) {
     457                return node;
     458        }
     459
     460        virtual const ast::Type *             visit( const ast::VarArgsType          * node ) {
     461                return node;
     462        }
     463
     464        virtual const ast::Type *             visit( const ast::ZeroType             * node ) {
     465                return node;
     466        }
     467
     468        virtual const ast::Type *             visit( const ast::OneType              * node ) {
     469                return node;
     470        }
     471
     472        virtual const ast::Type *             visit( const ast::GlobalScopeType      * node ) {
     473                return node;
     474        }
     475
     476        virtual const ast::Designation *      visit( const ast::Designation          * node ) {
     477                return node;
     478        }
     479
     480        virtual const ast::Init *             visit( const ast::SingleInit           * node ) {
     481                return node;
     482        }
     483
     484        virtual const ast::Init *             visit( const ast::ListInit             * node ) {
     485                return node;
     486        }
     487
     488        virtual const ast::Init *             visit( const ast::ConstructorInit      * node ) {
     489                return node;
     490        }
     491
     492        virtual const ast::Attribute *        visit( const ast::Attribute            * node ) {
     493                return node;
     494        }
     495
     496        virtual const ast::TypeSubstitution * visit( const ast::TypeSubstitution     * node ) {
     497                os << indent << "Types:" << std::endl;
     498                for ( const auto& i : *node ) {
     499                        os << indent+1 << i.first << " -> ";
     500                        indent += 2;
     501                        i.second->accept( *this );
     502                        indent -= 2;
     503                        os << std::endl;
    253504                }
    254                 return node;
    255         }
    256 
    257         virtual const ast::Decl * visit( const ast::TypedefDecl * node ) {
    258                 print( node );
    259                 return node;
    260         }
    261 
    262         virtual const ast::AsmDecl * visit( const ast::AsmDecl * node ) {
    263                 node->stmt->accept( *this );
    264                 return node;
    265         }
    266 
    267         virtual const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl * node ) {
    268                 os << "Static Assert with condition: ";
    269                 ++indent;
    270                 node->cond->accept( *this );
    271                 --indent;
    272                 os << endl << indent << "and message: ";
    273                 ++indent;
    274                 node->msg->accept( *this );
    275                 --indent;
    276                 os << endl;
    277                 return node;
    278         }
    279 
    280         virtual const ast::CompoundStmt * visit( const ast::CompoundStmt * node ) {
    281                 os << "CompoundStmt" << endl;
    282                 ++indent;
    283                 printAll( node->kids );
    284                 --indent;
    285                 return node;
    286         }
    287 
    288         virtual const ast::Stmt * visit( const ast::ExprStmt * node ) {
    289                 ++indent;
    290                 os << "Expression Statement:" << endl << indent;
    291                 node->expr->accept( *this );
    292                 --indent;
    293                 return node;
    294         }
    295 
    296         virtual const ast::Stmt * visit( const ast::AsmStmt * node ) {
    297                 os << "Assembler Statement:" << endl;
    298                 ++indent;
    299                 os << indent << "instruction: " << endl << indent;
    300                 node->instruction->accept( *this );
    301                 if ( ! node->output.empty() ) {
    302                         os << endl << indent+1 << "output: " << endl;
    303                         printAll( node->output );
    304                 } // if
    305                 if ( ! node->input.empty() ) {
    306                         os << indent+1 << "input: " << endl;
    307                         printAll( node->input );
    308                 } // if
    309                 if ( ! node->clobber.empty() ) {
    310                         os << indent+1 << "clobber: " << endl;
    311                         printAll( node->clobber );
    312                 } // if
    313                 --indent;
    314                 return node;
    315         }
    316 
    317         virtual const ast::Stmt * visit( const ast::DirectiveStmt * node ) {
    318                 os << "GCC Directive:" << node->directive << endl;
    319                 return node;
    320         }
    321 
    322         virtual const ast::Stmt * visit( const ast::IfStmt * node ) {
    323                 os << "If on condition: " << endl;
    324                 os << indent+1;
    325                 ++indent;
    326                 node->cond->accept( *this );
    327                 --indent;
    328 
    329                 if ( !node->inits.empty() ) {
    330                         os << indent << "... with initialization: \n";
    331                         ++indent;
    332                         for ( const Stmt * stmt : node->inits ) {
    333                                 os << indent;
    334                                 stmt->accept( *this );
    335                         }
    336                         --indent;
    337                         os << endl;
     505                os << indent << "Non-types:" << std::endl;
     506                for ( auto i = node->beginVar(); i != node->endVar(); ++i ) {
     507                        os << indent+1 << i->first << " -> ";
     508                        indent += 2;
     509                        i->second->accept( *this );
     510                        indent -= 2;
     511                        os << std::endl;
    338512                }
    339 
    340                 os << indent << "... then: " << endl;
    341 
    342                 ++indent;
    343                 os << indent;
    344                 node->thenPart->accept( *this );
    345                 --indent;
    346 
    347                 if ( node->elsePart != 0 ) {
    348                         os << indent << "... else: " << endl;
    349                         ++indent;
    350                         os << indent;
    351                         node->elsePart->accept( *this );
    352                         --indent;
    353                 } // if
    354                 return node;
    355         }
    356 
    357         virtual const ast::Stmt * visit( const ast::WhileStmt * node ) {
    358                 return node;
    359         }
    360 
    361         virtual const ast::Stmt * visit( const ast::ForStmt * node ) {
    362                 return node;
    363         }
    364 
    365         virtual const ast::Stmt * visit( const ast::SwitchStmt * node ) {
    366                 return node;
    367         }
    368 
    369         virtual const ast::Stmt * visit( const ast::CaseStmt * node ) {
    370                 return node;
    371         }
    372 
    373         virtual const ast::Stmt * visit( const ast::BranchStmt * node ) {
    374                 return node;
    375         }
    376 
    377         virtual const ast::Stmt * visit( const ast::ReturnStmt * node ) {
    378                 return node;
    379         }
    380 
    381         virtual const ast::Stmt * visit( const ast::ThrowStmt * node ) {
    382                 return node;
    383         }
    384 
    385         virtual const ast::Stmt * visit( const ast::TryStmt * node ) {
    386                 return node;
    387         }
    388 
    389         virtual const ast::Stmt * visit( const ast::CatchStmt * node ) {
    390                 return node;
    391         }
    392 
    393         virtual const ast::Stmt * visit( const ast::FinallyStmt * node ) {
    394                 return node;
    395         }
    396 
    397         virtual const ast::Stmt * visit( const ast::WaitForStmt * node ) {
    398                 return node;
    399         }
    400 
    401         virtual const ast::Stmt * visit( const ast::WithStmt * node ) {
    402                 return node;
    403         }
    404 
    405         virtual const ast::NullStmt * visit( const ast::NullStmt * node ) {
    406                 return node;
    407         }
    408 
    409         virtual const ast::Stmt * visit( const ast::DeclStmt * node ) {
    410                 return node;
    411         }
    412 
    413         virtual const ast::Stmt * visit( const ast::ImplicitCtorDtorStmt * node ) {
    414                 return node;
    415         }
    416 
    417         virtual const ast::Expr * visit( const ast::ApplicationExpr * node ) {
    418                 return node;
    419         }
    420 
    421         virtual const ast::Expr * visit( const ast::UntypedExpr * node ) {
    422                 return node;
    423         }
    424 
    425         virtual const ast::Expr * visit( const ast::NameExpr * node ) {
    426                 return node;
    427         }
    428 
    429         virtual const ast::Expr * visit( const ast::AddressExpr * node ) {
    430                 return node;
    431         }
    432 
    433         virtual const ast::Expr * visit( const ast::LabelAddressExpr * node ) {
    434                 return node;
    435         }
    436 
    437         virtual const ast::Expr * visit( const ast::CastExpr * node ) {
    438                 return node;
    439         }
    440 
    441         virtual const ast::Expr * visit( const ast::KeywordCastExpr * node ) {
    442                 return node;
    443         }
    444 
    445         virtual const ast::Expr * visit( const ast::VirtualCastExpr * node ) {
    446                 return node;
    447         }
    448 
    449         virtual const ast::Expr * visit( const ast::UntypedMemberExpr * node ) {
    450                 return node;
    451         }
    452 
    453         virtual const ast::Expr * visit( const ast::MemberExpr * node ) {
    454                 return node;
    455         }
    456 
    457         virtual const ast::Expr * visit( const ast::VariableExpr * node ) {
    458                 return node;
    459         }
    460 
    461         virtual const ast::Expr * visit( const ast::ConstantExpr * node ) {
    462                 return node;
    463         }
    464 
    465         virtual const ast::Expr * visit( const ast::SizeofExpr * node ) {
    466                 return node;
    467         }
    468 
    469         virtual const ast::Expr * visit( const ast::AlignofExpr * node ) {
    470                 return node;
    471         }
    472 
    473         virtual const ast::Expr * visit( const ast::UntypedOffsetofExpr * node ) {
    474                 return node;
    475         }
    476 
    477         virtual const ast::Expr * visit( const ast::OffsetofExpr * node ) {
    478                 return node;
    479         }
    480 
    481         virtual const ast::Expr * visit( const ast::OffsetPackExpr * node ) {
    482                 return node;
    483         }
    484 
    485         virtual const ast::Expr * visit( const ast::LogicalExpr * node ) {
    486                 return node;
    487         }
    488 
    489         virtual const ast::Expr * visit( const ast::ConditionalExpr * node ) {
    490                 return node;
    491         }
    492 
    493         virtual const ast::Expr * visit( const ast::CommaExpr * node ) {
    494                 return node;
    495         }
    496 
    497         virtual const ast::Expr * visit( const ast::TypeExpr * node ) {
    498                 return node;
    499         }
    500 
    501         virtual const ast::Expr * visit( const ast::AsmExpr * node ) {
    502                 return node;
    503         }
    504 
    505         virtual const ast::Expr * visit( const ast::ImplicitCopyCtorExpr * node ) {
    506                 return node;
    507         }
    508 
    509         virtual const ast::Expr * visit( const ast::ConstructorExpr * node ) {
    510                 return node;
    511         }
    512 
    513         virtual const ast::Expr * visit( const ast::CompoundLiteralExpr * node ) {
    514                 return node;
    515         }
    516 
    517         virtual const ast::Expr * visit( const ast::RangeExpr * node ) {
    518                 return node;
    519         }
    520 
    521         virtual const ast::Expr * visit( const ast::UntypedTupleExpr * node ) {
    522                 return node;
    523         }
    524 
    525         virtual const ast::Expr * visit( const ast::TupleExpr * node ) {
    526                 return node;
    527         }
    528 
    529         virtual const ast::Expr * visit( const ast::TupleIndexExpr * node ) {
    530                 return node;
    531         }
    532 
    533         virtual const ast::Expr * visit( const ast::TupleAssignExpr * node ) {
    534                 return node;
    535         }
    536 
    537         virtual const ast::Expr * visit( const ast::StmtExpr * node ) {
    538                 return node;
    539         }
    540 
    541         virtual const ast::Expr * visit( const ast::UniqueExpr * node ) {
    542                 return node;
    543         }
    544 
    545         virtual const ast::Expr * visit( const ast::UntypedInitExpr * node ) {
    546                 return node;
    547         }
    548 
    549         virtual const ast::Expr * visit( const ast::InitExpr * node ) {
    550                 return node;
    551         }
    552 
    553         virtual const ast::Expr * visit( const ast::DeletedExpr * node ) {
    554                 return node;
    555         }
    556 
    557         virtual const ast::Expr * visit( const ast::DefaultArgExpr * node ) {
    558                 return node;
    559         }
    560 
    561         virtual const ast::Expr * visit( const ast::GenericExpr * node ) {
    562                 return node;
    563         }
    564 
    565         virtual const ast::Type * visit( const ast::VoidType * node ) {
    566                 return node;
    567         }
    568 
    569         virtual const ast::Type * visit( const ast::BasicType * node ) {
    570                 return node;
    571         }
    572 
    573         virtual const ast::Type * visit( const ast::PointerType * node ) {
    574                 return node;
    575         }
    576 
    577         virtual const ast::Type * visit( const ast::ArrayType * node ) {
    578                 return node;
    579         }
    580 
    581         virtual const ast::Type * visit( const ast::ReferenceType * node ) {
    582                 return node;
    583         }
    584 
    585         virtual const ast::Type * visit( const ast::QualifiedType * node ) {
    586                 return node;
    587         }
    588 
    589         virtual const ast::Type * visit( const ast::FunctionType * node ) {
    590                 return node;
    591         }
    592 
    593         virtual const ast::Type * visit( const ast::StructInstType * node ) {
    594                 return node;
    595         }
    596 
    597         virtual const ast::Type * visit( const ast::UnionInstType * node ) {
    598                 return node;
    599         }
    600 
    601         virtual const ast::Type * visit( const ast::EnumInstType * node ) {
    602                 return node;
    603         }
    604 
    605         virtual const ast::Type * visit( const ast::TraitInstType * node ) {
    606                 return node;
    607         }
    608 
    609         virtual const ast::Type * visit( const ast::TypeInstType * node ) {
    610                 return node;
    611         }
    612 
    613         virtual const ast::Type * visit( const ast::TupleType * node ) {
    614                 return node;
    615         }
    616 
    617         virtual const ast::Type * visit( const ast::TypeofType * node ) {
    618                 return node;
    619         }
    620 
    621         virtual const ast::Type * visit( const ast::VarArgsType * node ) {
    622                 return node;
    623         }
    624 
    625         virtual const ast::Type * visit( const ast::ZeroType * node ) {
    626                 return node;
    627         }
    628 
    629         virtual const ast::Type * visit( const ast::OneType * node ) {
    630                 return node;
    631         }
    632 
    633         virtual const ast::Type * visit( const ast::GlobalScopeType * node ) {
    634                 return node;
    635         }
    636 
    637         virtual const ast::Designation * visit( const ast::Designation * node ) {
    638                 return node;
    639         }
    640 
    641         virtual const ast::Init * visit( const ast::SingleInit * node ) {
    642                 return node;
    643         }
    644 
    645         virtual const ast::Init * visit( const ast::ListInit * node ) {
    646                 return node;
    647         }
    648 
    649         virtual const ast::Init * visit( const ast::ConstructorInit * node ) {
    650                 return node;
    651         }
    652 
    653         virtual const ast::Attribute * visit( const ast::Attribute * node ) {
    654                 return node;
    655         }
    656 
    657         virtual const ast::TypeSubstitution * visit( const ast::TypeSubstitution * node ) {
    658513                return node;
    659514        }
     
    661516};
    662517
    663 void print( ostream & os, const ast::Node * node, Indenter indent ) {
    664         Printer printer { os, indent, false };
    665         node->accept(printer);
    666 }
    667 
    668 void printShort( ostream & os, const ast::Node * node, Indenter indent ) {
    669         Printer printer { os, indent, true };
     518void print( std::ostream & os, const ast::Node * node, Indenter indent ) {
     519        Printer printer { os, indent };
    670520        node->accept(printer);
    671521}
     
    674524// The size here needs to be explicit but at least the compiler will produce an error
    675525// if the wrong size is specified
    676 constexpr array<const char*, 3> Printer::Names::FuncSpecifiers;
    677 constexpr array<const char*, 5> Printer::Names::StorageClasses;
    678 constexpr array<const char*, 6> Printer::Names::Qualifiers;
     526constexpr std::array<const char*, 3> Printer::Names::FuncSpecifiers;
     527constexpr std::array<const char*, 5> Printer::Names::StorageClasses;
     528constexpr std::array<const char*, 6> Printer::Names::Qualifiers;
    679529}
Note: See TracChangeset for help on using the changeset viewer.