| [461046f] | 1 | //
|
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
|---|
| 3 | //
|
|---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
|---|
| 5 | // file "LICENCE" distributed with Cforall.
|
|---|
| 6 | //
|
|---|
| [0351e9f] | 7 | // Print.cpp -- Print an AST (or sub-tree) to a stream.
|
|---|
| [461046f] | 8 | //
|
|---|
| 9 | // Author : Thierry Delisle
|
|---|
| 10 | // Created On : Tue May 21 16:20:15 2019
|
|---|
| 11 | // Last Modified By :
|
|---|
| 12 | // Last Modified On :
|
|---|
| 13 | // Update Count :
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | #include "Print.hpp"
|
|---|
| 17 |
|
|---|
| [bccd70a] | 18 | #include "Attribute.hpp"
|
|---|
| [461046f] | 19 | #include "Decl.hpp"
|
|---|
| 20 | #include "Expr.hpp"
|
|---|
| [bccd70a] | 21 | #include "Init.hpp"
|
|---|
| [461046f] | 22 | #include "Stmt.hpp"
|
|---|
| 23 | #include "Type.hpp"
|
|---|
| 24 | #include "TypeSubstitution.hpp"
|
|---|
| [b26144d] | 25 | #include "CompilationState.h"
|
|---|
| [bccd70a] | 26 | #include "Common/Iterate.hpp"
|
|---|
| [a2e758e] | 27 |
|
|---|
| [5902625] | 28 | using namespace std;
|
|---|
| [461046f] | 29 |
|
|---|
| 30 | namespace ast {
|
|---|
| 31 |
|
|---|
| [257a8f5] | 32 | namespace {
|
|---|
| 33 |
|
|---|
| 34 | template<typename C, typename... T>
|
|---|
| 35 | constexpr array<C, sizeof...(T)> make_array( T&&... values ) {
|
|---|
| 36 | return array<C, sizeof...(T)>{ std::forward<T>( values )... };
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | namespace Names {
|
|---|
| 40 | static constexpr auto FuncSpecifiers = make_array<const char*>(
|
|---|
| 41 | "inline", "_Noreturn", "fortran"
|
|---|
| 42 | );
|
|---|
| 43 |
|
|---|
| 44 | static constexpr auto StorageClasses = make_array<const char*>(
|
|---|
| 45 | "extern", "static", "auto", "register", "__thread", "_Thread_local"
|
|---|
| 46 | );
|
|---|
| 47 |
|
|---|
| 48 | static constexpr auto Qualifiers = make_array<const char*>(
|
|---|
| 49 | "const", "restrict", "volatile", "mutex", "_Atomic"
|
|---|
| 50 | );
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | template<typename bits_t, size_t N>
|
|---|
| 54 | void print( ostream & os, const bits_t & bits,
|
|---|
| 55 | const array<const char *, N> & names ) {
|
|---|
| 56 | if ( !bits.any() ) return;
|
|---|
| 57 | for ( size_t i = 0 ; i < N ; i += 1 ) {
|
|---|
| 58 | if ( bits[i] ) {
|
|---|
| 59 | os << names[i] << ' ';
|
|---|
| 60 | }
|
|---|
| 61 | }
|
|---|
| [461046f] | 62 | }
|
|---|
| 63 |
|
|---|
| [e67991f] | 64 | class Printer final : public Visitor {
|
|---|
| [461046f] | 65 | public:
|
|---|
| [5902625] | 66 | ostream & os;
|
|---|
| [461046f] | 67 | Indenter indent;
|
|---|
| [5902625] | 68 | bool short_mode;
|
|---|
| [461046f] | 69 |
|
|---|
| [5902625] | 70 | Printer(ostream & os, Indenter indent, bool short_mode) : os( os ), indent( indent ), short_mode(short_mode) {}
|
|---|
| [461046f] | 71 |
|
|---|
| 72 | private:
|
|---|
| 73 | template< typename C >
|
|---|
| 74 | void printAll( const C & c ) {
|
|---|
| 75 | for ( const auto & i : c ) {
|
|---|
| 76 | if ( i ) {
|
|---|
| 77 | os << indent;
|
|---|
| 78 | i->accept( *this );
|
|---|
| 79 | // need an endl after each element because it's not
|
|---|
| 80 | // easy to know when each individual item should end
|
|---|
| [5902625] | 81 | os << endl;
|
|---|
| [461046f] | 82 | } // if
|
|---|
| 83 | } // for
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| [20a5977] | 86 | /// call if mandatory field is missing
|
|---|
| 87 | void undefined() {
|
|---|
| 88 | os << "UNDEFINED";
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | /// call for fields that should be mandatory
|
|---|
| 92 | void safe_print( const ast::Node * n ) {
|
|---|
| 93 | if ( n ) n->accept( *this );
|
|---|
| 94 | else undefined();
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | /// call to print short form. Incorporates features of safe_print()
|
|---|
| [6f4b7f2] | 98 | void short_print( const ast::Decl * n ) {
|
|---|
| [20a5977] | 99 | if ( ! n ) { undefined(); return; }
|
|---|
| 100 | bool old_short = short_mode; short_mode = true;
|
|---|
| 101 | n->accept( *this );
|
|---|
| 102 | short_mode = old_short;
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| [461046f] | 105 | static const char* Names[];
|
|---|
| 106 |
|
|---|
| [94b1f718] | 107 | void print( const std::vector<ast::Label> & labels ) {
|
|---|
| 108 | if ( labels.empty() ) return;
|
|---|
| 109 | os << indent << "... Labels: {";
|
|---|
| 110 | bool isFirst = true;
|
|---|
| 111 | for ( const Label & l : labels ) {
|
|---|
| 112 | if ( isFirst ) { isFirst = false; } else { os << ","; }
|
|---|
| 113 | os << l;
|
|---|
| 114 | }
|
|---|
| 115 | os << "}" << endl;
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| [20a5977] | 118 | void print( const ast::Expr::InferUnion & inferred, unsigned level = 0 ) {
|
|---|
| [79c907b] | 119 | if (inferred.data.resnSlots && !inferred.data.resnSlots->empty()) {
|
|---|
| 120 | os << indent << "with " << inferred.data.resnSlots->size()
|
|---|
| [94b1f718] | 121 | << " pending inference slots" << endl;
|
|---|
| [20a5977] | 122 | }
|
|---|
| [79c907b] | 123 | if (inferred.data.inferParams && !inferred.data.inferParams->empty()) {
|
|---|
| [94b1f718] | 124 | os << indent << "with inferred parameters " << level << ":" << endl;
|
|---|
| [20a5977] | 125 | ++indent;
|
|---|
| [79c907b] | 126 | for ( const auto & i : *inferred.data.inferParams ) {
|
|---|
| [20a5977] | 127 | os << indent;
|
|---|
| [79c907b] | 128 | short_print( i.second.declptr );
|
|---|
| [94b1f718] | 129 | os << endl;
|
|---|
| [20a5977] | 130 | print( i.second.expr->inferred, level+1 );
|
|---|
| 131 | }
|
|---|
| 132 | --indent;
|
|---|
| 133 | }
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| [361bf01] | 136 | void print( const ast::FunctionType::ForallList & forall ) {
|
|---|
| [d908563] | 137 | if ( forall.empty() ) return;
|
|---|
| [94b1f718] | 138 | os << "forall" << endl;
|
|---|
| [b0ec971] | 139 | ++indent;
|
|---|
| 140 | printAll( forall );
|
|---|
| 141 | os << indent;
|
|---|
| 142 | --indent;
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| [3e5dd913] | 145 | void print( const ast::FunctionType::AssertionList & assts ) {
|
|---|
| 146 | if (assts.empty()) return;
|
|---|
| 147 | os << "with assertions" << endl;
|
|---|
| 148 | ++indent;
|
|---|
| 149 | printAll(assts);
|
|---|
| 150 | os << indent;
|
|---|
| 151 | --indent;
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| [b0ec971] | 154 | void print( const std::vector<ptr<Attribute>> & attrs ) {
|
|---|
| 155 | if ( attrs.empty() ) return;
|
|---|
| [94b1f718] | 156 | os << "with attributes" << endl;
|
|---|
| [b0ec971] | 157 | ++indent;
|
|---|
| 158 | printAll( attrs );
|
|---|
| 159 | --indent;
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | void print( const std::vector<ptr<Expr>> & params ) {
|
|---|
| 163 | if ( params.empty() ) return;
|
|---|
| [94b1f718] | 164 | os << endl << indent << "... with parameters" << endl;
|
|---|
| [b0ec971] | 165 | ++indent;
|
|---|
| 166 | printAll( params );
|
|---|
| 167 | --indent;
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| [5902625] | 170 | void print( const ast::AggregateDecl * node ) {
|
|---|
| [6f4b7f2] | 171 | os << node->typeString() << " " << node->name;
|
|---|
| [a7d50b6] | 172 |
|
|---|
| [6f4b7f2] | 173 | if ( ! short_mode && node->linkage != Linkage::Cforall ) {
|
|---|
| [5902625] | 174 | os << " " << Linkage::name( node->linkage );
|
|---|
| [6f4b7f2] | 175 | }
|
|---|
| [a7d50b6] | 176 |
|
|---|
| [16afb2a] | 177 | auto ptrToEnum = dynamic_cast<const ast::EnumDecl *>(node);
|
|---|
| 178 | if ( ! short_mode && ptrToEnum && ptrToEnum->base ) {
|
|---|
| 179 | os << endl << indent << "... with base type" << endl;
|
|---|
| 180 | ++indent;
|
|---|
| 181 | os << indent;
|
|---|
| 182 | ptrToEnum->base->accept( *this );
|
|---|
| 183 | --indent;
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| [6f4b7f2] | 186 | os << " " << (node->body ? "with" : "without") << " body";
|
|---|
| [5902625] | 187 |
|
|---|
| 188 | if ( ! node->params.empty() ) {
|
|---|
| 189 | os << endl << indent << "... with parameters" << endl;
|
|---|
| 190 | ++indent;
|
|---|
| 191 | printAll( node->params );
|
|---|
| 192 | --indent;
|
|---|
| [6f4b7f2] | 193 | }
|
|---|
| 194 |
|
|---|
| 195 | if ( ! short_mode && ! node->members.empty() ) {
|
|---|
| [5902625] | 196 | os << endl << indent << "... with members" << endl;
|
|---|
| 197 | ++indent;
|
|---|
| 198 | printAll( node->members );
|
|---|
| 199 | --indent;
|
|---|
| [6f4b7f2] | 200 | }
|
|---|
| 201 |
|
|---|
| 202 | if ( ! short_mode && ! node->attributes.empty() ) {
|
|---|
| [5902625] | 203 | os << endl << indent << "... with attributes" << endl;
|
|---|
| 204 | ++indent;
|
|---|
| 205 | printAll( node->attributes );
|
|---|
| 206 | --indent;
|
|---|
| [6f4b7f2] | 207 | }
|
|---|
| 208 |
|
|---|
| [16afb2a] | 209 |
|
|---|
| [4559b34] | 210 |
|
|---|
| [5902625] | 211 | os << endl;
|
|---|
| 212 | }
|
|---|
| 213 |
|
|---|
| [cf3da24] | 214 | void print( const ast::WaitStmt * node ) {
|
|---|
| [c86b08d] | 215 | if ( node->timeout_time ) {
|
|---|
| 216 | os << indent-1 << "timeout of:" << endl;
|
|---|
| 217 | node->timeout_time->accept( *this );
|
|---|
| 218 |
|
|---|
| 219 | if ( node->timeout_stmt ) {
|
|---|
| 220 | os << indent-1 << "... with statment:" << endl;
|
|---|
| 221 | node->timeout_stmt->accept( *this );
|
|---|
| 222 | }
|
|---|
| 223 |
|
|---|
| 224 | if ( node->timeout_cond ) {
|
|---|
| 225 | os << indent-1 << "... with condition:" << endl;
|
|---|
| 226 | node->timeout_cond->accept( *this );
|
|---|
| 227 | }
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| 230 | if ( node->else_stmt ) {
|
|---|
| 231 | os << indent-1 << "else:" << endl;
|
|---|
| 232 | node->else_stmt->accept( *this );
|
|---|
| 233 |
|
|---|
| 234 | if ( node->else_cond ) {
|
|---|
| 235 | os << indent-1 << "... with condition:" << endl;
|
|---|
| 236 | node->else_cond->accept( *this );
|
|---|
| 237 | }
|
|---|
| 238 | }
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| [6f4b7f2] | 241 | void preprint( const ast::NamedTypeDecl * node ) {
|
|---|
| [cd6a6ff] | 242 | if ( ! node->name.empty() ) {
|
|---|
| [3e5dd913] | 243 | os << node->name << ": ";
|
|---|
| [cd6a6ff] | 244 | }
|
|---|
| [5902625] | 245 |
|
|---|
| [6f4b7f2] | 246 | if ( ! short_mode && node->linkage != Linkage::Cforall ) {
|
|---|
| [5902625] | 247 | os << Linkage::name( node->linkage ) << " ";
|
|---|
| [6f4b7f2] | 248 | }
|
|---|
| 249 |
|
|---|
| [257a8f5] | 250 | ast::print( os, node->storage );
|
|---|
| [5902625] | 251 | os << node->typeString();
|
|---|
| [a7d50b6] | 252 |
|
|---|
| [5902625] | 253 | if ( node->base ) {
|
|---|
| 254 | os << " for ";
|
|---|
| 255 | ++indent;
|
|---|
| 256 | node->base->accept( *this );
|
|---|
| 257 | --indent;
|
|---|
| [6f4b7f2] | 258 | }
|
|---|
| 259 |
|
|---|
| [79c907b] | 260 | if ( ! node->assertions.empty() ) {
|
|---|
| [5902625] | 261 | os << endl << indent << "... with assertions" << endl;
|
|---|
| 262 | ++indent;
|
|---|
| 263 | printAll( node->assertions );
|
|---|
| 264 | --indent;
|
|---|
| [6f4b7f2] | 265 | }
|
|---|
| [5902625] | 266 | }
|
|---|
| [b0ec971] | 267 |
|
|---|
| [20a5977] | 268 | void postprint( const ast::Expr * node ) {
|
|---|
| 269 | print( node->inferred );
|
|---|
| 270 |
|
|---|
| [ef9988b] | 271 | if ( node->result ) {
|
|---|
| [cd6a6ff] | 272 | os << endl << indent << "... with resolved type:" << endl;
|
|---|
| 273 | ++indent;
|
|---|
| 274 | os << indent;
|
|---|
| 275 | node->result->accept( *this );
|
|---|
| 276 | --indent;
|
|---|
| [ef9988b] | 277 | }
|
|---|
| 278 |
|
|---|
| [20a5977] | 279 | if ( node->env ) {
|
|---|
| [94b1f718] | 280 | os << endl << indent << "... with environment:" << endl;
|
|---|
| [20a5977] | 281 | ++indent;
|
|---|
| 282 | node->env->accept( *this );
|
|---|
| 283 | --indent;
|
|---|
| 284 | }
|
|---|
| [a16e246] | 285 |
|
|---|
| [20a5977] | 286 | if ( node->extension ) {
|
|---|
| [94b1f718] | 287 | os << endl << indent << "... with extension";
|
|---|
| [20a5977] | 288 | }
|
|---|
| 289 | }
|
|---|
| 290 |
|
|---|
| 291 | void preprint( const ast::Type * node ) {
|
|---|
| [257a8f5] | 292 | ast::print( os, node->qualifiers );
|
|---|
| [20a5977] | 293 | }
|
|---|
| 294 |
|
|---|
| [361bf01] | 295 | void preprint( const ast::FunctionType * node ) {
|
|---|
| [20a5977] | 296 | print( node->forall );
|
|---|
| [3e5dd913] | 297 | print( node->assertions );
|
|---|
| [257a8f5] | 298 | ast::print( os, node->qualifiers );
|
|---|
| [20a5977] | 299 | }
|
|---|
| 300 |
|
|---|
| [98e8b3b] | 301 | void preprint( const ast::BaseInstType * node ) {
|
|---|
| [20a5977] | 302 | print( node->attributes );
|
|---|
| [257a8f5] | 303 | ast::print( os, node->qualifiers );
|
|---|
| [20a5977] | 304 | }
|
|---|
| 305 |
|
|---|
| [461046f] | 306 | public:
|
|---|
| [e67991f] | 307 | virtual const ast::DeclWithType * visit( const ast::ObjectDecl * node ) override final {
|
|---|
| [6f4b7f2] | 308 | if ( ! node->name.empty() ) os << node->name << ": ";
|
|---|
| [461046f] | 309 |
|
|---|
| [6f4b7f2] | 310 | if ( ! short_mode && node->linkage != Linkage::Cforall ) {
|
|---|
| [461046f] | 311 | os << Linkage::name( node->linkage ) << " ";
|
|---|
| [6f4b7f2] | 312 | }
|
|---|
| [461046f] | 313 |
|
|---|
| [257a8f5] | 314 | ast::print( os, node->storage );
|
|---|
| [461046f] | 315 |
|
|---|
| 316 | if ( node->type ) {
|
|---|
| 317 | node->type->accept( *this );
|
|---|
| 318 | } else {
|
|---|
| [20a5977] | 319 | os << "untyped entity";
|
|---|
| [6f4b7f2] | 320 | }
|
|---|
| [461046f] | 321 |
|
|---|
| [6f4b7f2] | 322 | if ( ! short_mode && node->init ) {
|
|---|
| 323 | ++indent;
|
|---|
| [461046f] | 324 | os << " with initializer (" << (
|
|---|
| 325 | node->init->maybeConstructed
|
|---|
| 326 | ? "maybe constructed"
|
|---|
| 327 | : "not constructed"
|
|---|
| [6f4b7f2] | 328 | ) << ")" << endl << indent;
|
|---|
| [461046f] | 329 | node->init->accept( *this );
|
|---|
| 330 | --indent;
|
|---|
| [5902625] | 331 | os << endl;
|
|---|
| [6f4b7f2] | 332 | }
|
|---|
| [461046f] | 333 |
|
|---|
| [6f4b7f2] | 334 | if ( ! short_mode && ! node->attributes.empty() ) {
|
|---|
| [5902625] | 335 | os << endl << indent << "... with attributes:" << endl;
|
|---|
| [461046f] | 336 | ++indent;
|
|---|
| 337 | printAll( node->attributes );
|
|---|
| 338 | --indent;
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | if ( node->bitfieldWidth ) {
|
|---|
| 342 | os << indent << " with bitfield width ";
|
|---|
| 343 | node->bitfieldWidth->accept( *this );
|
|---|
| [6f4b7f2] | 344 | }
|
|---|
| 345 |
|
|---|
| [461046f] | 346 | return node;
|
|---|
| 347 | }
|
|---|
| 348 |
|
|---|
| [e67991f] | 349 | virtual const ast::DeclWithType * visit( const ast::FunctionDecl * node ) override final {
|
|---|
| [6f4b7f2] | 350 | if ( !node->name.empty() ) os << node->name << ": ";
|
|---|
| 351 |
|
|---|
| 352 | if ( ! short_mode && node->linkage != Linkage::Cforall ) {
|
|---|
| [5902625] | 353 | os << Linkage::name( node->linkage ) << " ";
|
|---|
| [6f4b7f2] | 354 | }
|
|---|
| [5902625] | 355 |
|
|---|
| [6f4b7f2] | 356 | if ( ! short_mode ) printAll( node->attributes );
|
|---|
| [5902625] | 357 |
|
|---|
| [257a8f5] | 358 | ast::print( os, node->storage );
|
|---|
| 359 | ast::print( os, node->funcSpec );
|
|---|
| [451d958] | 360 |
|
|---|
| 361 | if ( node->type && node->isTypeFixed ) {
|
|---|
| [5902625] | 362 | node->type->accept( *this );
|
|---|
| 363 | } else {
|
|---|
| [451d958] | 364 | if (!node->type_params.empty()) {
|
|---|
| 365 | os << "forall" << endl;
|
|---|
| 366 | ++indent;
|
|---|
| 367 | printAll(node->type_params);
|
|---|
| 368 | os << indent;
|
|---|
| 369 | --indent;
|
|---|
| 370 |
|
|---|
| 371 | if (!node->assertions.empty()) {
|
|---|
| 372 | os << "with assertions" << endl;
|
|---|
| 373 | ++indent;
|
|---|
| 374 | printAll(node->assertions);
|
|---|
| 375 | os << indent;
|
|---|
| 376 | --indent;
|
|---|
| 377 | }
|
|---|
| 378 | }
|
|---|
| 379 |
|
|---|
| 380 | os << "function" << endl;
|
|---|
| 381 | if ( ! node->params.empty() ) {
|
|---|
| 382 | os << indent << "... with parameters" << endl;
|
|---|
| 383 | ++indent;
|
|---|
| 384 | printAll( node->params );
|
|---|
| 385 | if ( node->type->isVarArgs ) {
|
|---|
| 386 | os << indent << "and a variable number of other arguments" << endl;
|
|---|
| 387 | }
|
|---|
| 388 | --indent;
|
|---|
| 389 | } else if ( node->type->isVarArgs ) {
|
|---|
| 390 | os << indent+1 << "accepting unspecified arguments" << endl;
|
|---|
| 391 | }
|
|---|
| 392 |
|
|---|
| 393 | os << indent << "... returning";
|
|---|
| 394 | if ( node->returns.empty() ) {
|
|---|
| 395 | os << " nothing" << endl;
|
|---|
| 396 | } else {
|
|---|
| 397 | os << endl;
|
|---|
| 398 | ++indent;
|
|---|
| 399 | printAll( node->returns );
|
|---|
| 400 | --indent;
|
|---|
| 401 | }
|
|---|
| [6f4b7f2] | 402 | }
|
|---|
| [5902625] | 403 |
|
|---|
| [056bee8] | 404 | if ( ! node->withExprs.empty() ) {
|
|---|
| 405 | // Not with a clause, but the 'with clause'.
|
|---|
| 406 | ++indent;
|
|---|
| 407 | os << " with clause" << endl << indent;
|
|---|
| 408 | printAll( node->withExprs );
|
|---|
| 409 | --indent;
|
|---|
| 410 | }
|
|---|
| 411 |
|
|---|
| [6f4b7f2] | 412 | if ( ! short_mode && node->stmts ) {
|
|---|
| [5902625] | 413 | ++indent;
|
|---|
| [6f4b7f2] | 414 | os << " with body" << endl << indent;
|
|---|
| [5902625] | 415 | node->stmts->accept( *this );
|
|---|
| 416 | --indent;
|
|---|
| [6f4b7f2] | 417 | }
|
|---|
| 418 |
|
|---|
| [461046f] | 419 | return node;
|
|---|
| 420 | }
|
|---|
| 421 |
|
|---|
| [e67991f] | 422 | virtual const ast::Decl * visit( const ast::StructDecl * node ) override final {
|
|---|
| [5902625] | 423 | print(node);
|
|---|
| [461046f] | 424 | return node;
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| [71806e0] | 427 | virtual const ast::DeclWithType * visit( const ast::InlineMemberDecl * node ) override final {
|
|---|
| [e874605] | 428 | os << "inline ";
|
|---|
| 429 | if ( ! node->name.empty() ) os << node->name;
|
|---|
| 430 |
|
|---|
| 431 | return node;
|
|---|
| 432 | }
|
|---|
| 433 |
|
|---|
| [e67991f] | 434 | virtual const ast::Decl * visit( const ast::UnionDecl * node ) override final {
|
|---|
| [5902625] | 435 | print(node);
|
|---|
| [461046f] | 436 | return node;
|
|---|
| 437 | }
|
|---|
| 438 |
|
|---|
| [e67991f] | 439 | virtual const ast::Decl * visit( const ast::EnumDecl * node ) override final {
|
|---|
| [5902625] | 440 | print(node);
|
|---|
| [461046f] | 441 | return node;
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| [e67991f] | 444 | virtual const ast::Decl * visit( const ast::TraitDecl * node ) override final {
|
|---|
| [5902625] | 445 | print(node);
|
|---|
| [461046f] | 446 | return node;
|
|---|
| 447 | }
|
|---|
| 448 |
|
|---|
| [e67991f] | 449 | virtual const ast::Decl * visit( const ast::TypeDecl * node ) override final {
|
|---|
| [6f4b7f2] | 450 | preprint( node );
|
|---|
| 451 | if ( ! short_mode && node->init ) {
|
|---|
| [5902625] | 452 | os << endl << indent << "with type initializer: ";
|
|---|
| 453 | ++indent;
|
|---|
| 454 | node->init->accept( *this );
|
|---|
| 455 | --indent;
|
|---|
| 456 | }
|
|---|
| [6f4b7f2] | 457 |
|
|---|
| [461046f] | 458 | return node;
|
|---|
| 459 | }
|
|---|
| 460 |
|
|---|
| [e67991f] | 461 | virtual const ast::Decl * visit( const ast::TypedefDecl * node ) override final {
|
|---|
| [6f4b7f2] | 462 | preprint( node );
|
|---|
| [461046f] | 463 | return node;
|
|---|
| 464 | }
|
|---|
| 465 |
|
|---|
| [e67991f] | 466 | virtual const ast::AsmDecl * visit( const ast::AsmDecl * node ) override final {
|
|---|
| [6f4b7f2] | 467 | safe_print( node->stmt );
|
|---|
| [461046f] | 468 | return node;
|
|---|
| 469 | }
|
|---|
| 470 |
|
|---|
| [2d019af] | 471 | virtual const ast::DirectiveDecl * visit( const ast::DirectiveDecl * node ) override final {
|
|---|
| 472 | safe_print( node->stmt );
|
|---|
| 473 | return node;
|
|---|
| 474 | }
|
|---|
| 475 |
|
|---|
| [e67991f] | 476 | virtual const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl * node ) override final {
|
|---|
| [5902625] | 477 | os << "Static Assert with condition: ";
|
|---|
| 478 | ++indent;
|
|---|
| [6f4b7f2] | 479 | safe_print( node->cond );
|
|---|
| 480 | os << endl << indent-1 << "and message: ";
|
|---|
| 481 | safe_print( node->msg );
|
|---|
| [5902625] | 482 | --indent;
|
|---|
| 483 | os << endl;
|
|---|
| [6f4b7f2] | 484 |
|
|---|
| [461046f] | 485 | return node;
|
|---|
| 486 | }
|
|---|
| 487 |
|
|---|
| [e67991f] | 488 | virtual const ast::CompoundStmt * visit( const ast::CompoundStmt * node ) override final {
|
|---|
| [94b1f718] | 489 | os << "Compound Statement:" << endl;
|
|---|
| [5902625] | 490 | ++indent;
|
|---|
| 491 | printAll( node->kids );
|
|---|
| 492 | --indent;
|
|---|
| [461046f] | 493 | return node;
|
|---|
| 494 | }
|
|---|
| 495 |
|
|---|
| [e67991f] | 496 | virtual const ast::Stmt * visit( const ast::ExprStmt * node ) override final {
|
|---|
| [5902625] | 497 | ++indent;
|
|---|
| 498 | os << "Expression Statement:" << endl << indent;
|
|---|
| [20a5977] | 499 | safe_print( node->expr );
|
|---|
| [5902625] | 500 | --indent;
|
|---|
| [461046f] | 501 | return node;
|
|---|
| 502 | }
|
|---|
| 503 |
|
|---|
| [e67991f] | 504 | virtual const ast::Stmt * visit( const ast::AsmStmt * node ) override final {
|
|---|
| [5902625] | 505 | os << "Assembler Statement:" << endl;
|
|---|
| 506 | ++indent;
|
|---|
| [94b1f718] | 507 | os << indent-1 << "instruction:" << endl << indent;
|
|---|
| 508 | safe_print( node->instruction );
|
|---|
| [5902625] | 509 | if ( ! node->output.empty() ) {
|
|---|
| [94b1f718] | 510 | os << endl << indent << "output:" << endl;
|
|---|
| [5902625] | 511 | printAll( node->output );
|
|---|
| 512 | } // if
|
|---|
| 513 | if ( ! node->input.empty() ) {
|
|---|
| [94b1f718] | 514 | os << indent << "input:" << endl;
|
|---|
| [5902625] | 515 | printAll( node->input );
|
|---|
| 516 | } // if
|
|---|
| 517 | if ( ! node->clobber.empty() ) {
|
|---|
| [94b1f718] | 518 | os << indent << "clobber:" << endl;
|
|---|
| [5902625] | 519 | printAll( node->clobber );
|
|---|
| 520 | } // if
|
|---|
| 521 | --indent;
|
|---|
| [461046f] | 522 | return node;
|
|---|
| 523 | }
|
|---|
| 524 |
|
|---|
| [e67991f] | 525 | virtual const ast::Stmt * visit( const ast::DirectiveStmt * node ) override final {
|
|---|
| [94b1f718] | 526 | os << "GCC Directive: " << node->directive << endl;
|
|---|
| [461046f] | 527 | return node;
|
|---|
| 528 | }
|
|---|
| 529 |
|
|---|
| [e67991f] | 530 | virtual const ast::Stmt * visit( const ast::IfStmt * node ) override final {
|
|---|
| [94b1f718] | 531 | os << "If on condition:" << endl;
|
|---|
| [5902625] | 532 | ++indent;
|
|---|
| [94b1f718] | 533 | os << indent;
|
|---|
| [20a5977] | 534 | safe_print( node->cond );
|
|---|
| [5902625] | 535 | --indent;
|
|---|
| 536 |
|
|---|
| [94b1f718] | 537 | if ( ! node->inits.empty() ) {
|
|---|
| 538 | os << indent << "... with initialization:" << endl;
|
|---|
| [5902625] | 539 | ++indent;
|
|---|
| [94b1f718] | 540 | for ( const ast::Stmt * stmt : node->inits ) {
|
|---|
| [5902625] | 541 | os << indent;
|
|---|
| [94b1f718] | 542 | safe_print( stmt );
|
|---|
| [5902625] | 543 | }
|
|---|
| 544 | --indent;
|
|---|
| 545 | os << endl;
|
|---|
| 546 | }
|
|---|
| 547 |
|
|---|
| [94b1f718] | 548 | os << indent << "... then:" << endl;
|
|---|
| [5902625] | 549 |
|
|---|
| 550 | ++indent;
|
|---|
| 551 | os << indent;
|
|---|
| [3b0bc16] | 552 | safe_print( node->then );
|
|---|
| [5902625] | 553 | --indent;
|
|---|
| 554 |
|
|---|
| [3b0bc16] | 555 | if ( node->else_ != 0 ) {
|
|---|
| [94b1f718] | 556 | os << indent << "... else:" << endl;
|
|---|
| [5902625] | 557 | ++indent;
|
|---|
| 558 | os << indent;
|
|---|
| [3b0bc16] | 559 | node->else_->accept( *this );
|
|---|
| [5902625] | 560 | --indent;
|
|---|
| 561 | } // if
|
|---|
| [461046f] | 562 | return node;
|
|---|
| 563 | }
|
|---|
| 564 |
|
|---|
| [3b0bc16] | 565 | virtual const ast::Stmt * visit( const ast::WhileDoStmt * node ) override final {
|
|---|
| [94b1f718] | 566 | if ( node->isDoWhile ) { os << "Do-"; }
|
|---|
| 567 | os << "While on condition:" << endl;
|
|---|
| 568 | ++indent;
|
|---|
| 569 | safe_print( node->cond );
|
|---|
| 570 | os << indent-1 << "... with body:" << endl;
|
|---|
| 571 | safe_print( node->body );
|
|---|
| 572 |
|
|---|
| 573 | if ( ! node->inits.empty() ) {
|
|---|
| 574 | os << indent-1 << "... with inits:" << endl;
|
|---|
| 575 | printAll( node->inits );
|
|---|
| 576 | }
|
|---|
| 577 | --indent;
|
|---|
| 578 |
|
|---|
| [461046f] | 579 | return node;
|
|---|
| 580 | }
|
|---|
| 581 |
|
|---|
| [e67991f] | 582 | virtual const ast::Stmt * visit( const ast::ForStmt * node ) override final {
|
|---|
| [94b1f718] | 583 | os << "For Statement" << endl;
|
|---|
| 584 |
|
|---|
| 585 | if ( ! node->inits.empty() ) {
|
|---|
| 586 | os << indent << "... initialization:" << endl;
|
|---|
| 587 | ++indent;
|
|---|
| 588 | for ( const ast::Stmt * stmt : node->inits ) {
|
|---|
| 589 | os << indent+1;
|
|---|
| 590 | safe_print( stmt );
|
|---|
| 591 | }
|
|---|
| 592 | --indent;
|
|---|
| 593 | }
|
|---|
| 594 |
|
|---|
| 595 | if ( node->cond ) {
|
|---|
| 596 | os << indent << "... condition:" << endl;
|
|---|
| 597 | ++indent;
|
|---|
| 598 | os << indent;
|
|---|
| 599 | node->cond->accept( *this );
|
|---|
| 600 | --indent;
|
|---|
| 601 | }
|
|---|
| 602 |
|
|---|
| 603 | if ( node->inc ) {
|
|---|
| 604 | os << indent << "... increment:" << endl;
|
|---|
| 605 | ++indent;
|
|---|
| 606 | os << indent;
|
|---|
| 607 | node->inc->accept( *this );
|
|---|
| 608 | --indent;
|
|---|
| 609 | }
|
|---|
| 610 |
|
|---|
| 611 | if ( node->body ) {
|
|---|
| 612 | os << indent << "... with body:" << endl;
|
|---|
| 613 | ++indent;
|
|---|
| 614 | os << indent;
|
|---|
| 615 | node->body->accept( *this );
|
|---|
| 616 | --indent;
|
|---|
| 617 | }
|
|---|
| 618 | os << endl;
|
|---|
| 619 | print( node->labels );
|
|---|
| 620 |
|
|---|
| [461046f] | 621 | return node;
|
|---|
| 622 | }
|
|---|
| 623 |
|
|---|
| [e67991f] | 624 | virtual const ast::Stmt * visit( const ast::SwitchStmt * node ) override final {
|
|---|
| [94b1f718] | 625 | os << "Switch on condition: ";
|
|---|
| 626 | safe_print( node->cond );
|
|---|
| 627 | os << endl;
|
|---|
| 628 |
|
|---|
| 629 | ++indent;
|
|---|
| [400b8be] | 630 | for ( const ast::CaseClause * stmt : node->cases ) {
|
|---|
| [94b1f718] | 631 | stmt->accept( *this );
|
|---|
| 632 | }
|
|---|
| 633 | --indent;
|
|---|
| 634 |
|
|---|
| [461046f] | 635 | return node;
|
|---|
| 636 | }
|
|---|
| 637 |
|
|---|
| [400b8be] | 638 | virtual const ast::CaseClause * visit( const ast::CaseClause * node ) override final {
|
|---|
| [94b1f718] | 639 | if ( node->isDefault() ) {
|
|---|
| 640 | os << indent << "Default ";
|
|---|
| 641 | } else {
|
|---|
| 642 | os << indent << "Case ";
|
|---|
| 643 | safe_print( node->cond );
|
|---|
| 644 | } // if
|
|---|
| 645 | os << endl;
|
|---|
| 646 |
|
|---|
| 647 | ++indent;
|
|---|
| 648 | for ( const ast::Stmt * stmt : node->stmts ) {
|
|---|
| 649 | os << indent;
|
|---|
| 650 | stmt->accept( *this );
|
|---|
| 651 | }
|
|---|
| 652 | --indent;
|
|---|
| 653 |
|
|---|
| [461046f] | 654 | return node;
|
|---|
| 655 | }
|
|---|
| 656 |
|
|---|
| [e67991f] | 657 | virtual const ast::Stmt * visit( const ast::BranchStmt * node ) override final {
|
|---|
| [94b1f718] | 658 | os << "Branch (" << node->kindName() << ")" << endl;
|
|---|
| 659 | ++indent;
|
|---|
| 660 | if ( ! node->target.empty() ) {
|
|---|
| 661 | os << indent << "with target: " << node->target << endl;
|
|---|
| 662 | }
|
|---|
| 663 |
|
|---|
| 664 | if ( ! node->originalTarget.empty() ) {
|
|---|
| 665 | os << indent << "with original target: " << node->originalTarget << endl;
|
|---|
| 666 | }
|
|---|
| 667 |
|
|---|
| 668 | if ( node->computedTarget ) {
|
|---|
| 669 | os << indent << "with computed target: ";
|
|---|
| 670 | node->computedTarget->accept( *this );
|
|---|
| 671 | os << endl;
|
|---|
| 672 | }
|
|---|
| 673 | --indent;
|
|---|
| 674 |
|
|---|
| [461046f] | 675 | return node;
|
|---|
| 676 | }
|
|---|
| 677 |
|
|---|
| [e67991f] | 678 | virtual const ast::Stmt * visit( const ast::ReturnStmt * node ) override final {
|
|---|
| [94b1f718] | 679 | os << "Return Statement, returning";
|
|---|
| 680 | if ( node->expr ) {
|
|---|
| 681 | ++indent;
|
|---|
| 682 | os << ":" << endl << indent;
|
|---|
| 683 | node->expr->accept( *this );
|
|---|
| 684 | --indent;
|
|---|
| 685 | } else {
|
|---|
| 686 | os << " void";
|
|---|
| 687 | }
|
|---|
| 688 | os << endl;
|
|---|
| 689 |
|
|---|
| [461046f] | 690 | return node;
|
|---|
| 691 | }
|
|---|
| 692 |
|
|---|
| [e67991f] | 693 | virtual const ast::Stmt * visit( const ast::ThrowStmt * node ) override final {
|
|---|
| [6f4b7f2] | 694 | if ( node->target ) os << "Non-Local ";
|
|---|
| 695 |
|
|---|
| 696 | switch( node->kind ) {
|
|---|
| 697 | case ast::ExceptionKind::Terminate: os << "Terminate "; break;
|
|---|
| 698 | case ast::ExceptionKind::Resume: os << "Resume "; break;
|
|---|
| 699 | }
|
|---|
| 700 |
|
|---|
| 701 | ++indent;
|
|---|
| 702 | os << "Throw Statement, raising: ";
|
|---|
| 703 | safe_print( node->expr );
|
|---|
| 704 | if ( node->target ) {
|
|---|
| 705 | os << "... at: ";
|
|---|
| 706 | node->target->accept( *this );
|
|---|
| 707 | }
|
|---|
| 708 | --indent;
|
|---|
| 709 |
|
|---|
| [461046f] | 710 | return node;
|
|---|
| 711 | }
|
|---|
| 712 |
|
|---|
| [e67991f] | 713 | virtual const ast::Stmt * visit( const ast::TryStmt * node ) override final {
|
|---|
| [6f4b7f2] | 714 | ++indent;
|
|---|
| [a7d50b6] | 715 | os << "Try Statement" << endl << indent-1
|
|---|
| [6f4b7f2] | 716 | << "... with block:" << endl << indent;
|
|---|
| 717 | safe_print( node->body );
|
|---|
| 718 |
|
|---|
| 719 | os << indent-1 << "... and handlers:" << endl;
|
|---|
| [400b8be] | 720 | for ( const ast::CatchClause * stmt : node->handlers ) {
|
|---|
| [6f4b7f2] | 721 | os << indent;
|
|---|
| 722 | stmt->accept( *this );
|
|---|
| 723 | }
|
|---|
| 724 |
|
|---|
| 725 | if ( node->finally ) {
|
|---|
| 726 | os << indent-1 << "... and finally:" << endl << indent;
|
|---|
| 727 | node->finally->accept( *this );
|
|---|
| 728 | }
|
|---|
| 729 | --indent;
|
|---|
| 730 |
|
|---|
| [461046f] | 731 | return node;
|
|---|
| 732 | }
|
|---|
| 733 |
|
|---|
| [400b8be] | 734 | virtual const ast::CatchClause * visit( const ast::CatchClause * node ) override final {
|
|---|
| [6f4b7f2] | 735 | os << "Catch ";
|
|---|
| 736 | switch ( node->kind ) {
|
|---|
| 737 | case ast::ExceptionKind::Terminate: os << "Terminate "; break;
|
|---|
| 738 | case ast::ExceptionKind::Resume: os << "Resume "; break;
|
|---|
| 739 | }
|
|---|
| 740 | os << "Statement" << endl << indent;
|
|---|
| 741 |
|
|---|
| 742 | ++indent;
|
|---|
| 743 | os << "... catching: ";
|
|---|
| 744 | short_print( node->decl );
|
|---|
| 745 | os << endl;
|
|---|
| 746 |
|
|---|
| 747 | if ( node->cond ) {
|
|---|
| 748 | os << indent-1 << "... with conditional:" << endl << indent;
|
|---|
| 749 | node->cond->accept( *this );
|
|---|
| 750 | }
|
|---|
| 751 |
|
|---|
| 752 | os << indent-1 << "... with block:" << endl << indent;
|
|---|
| 753 | safe_print( node->body );
|
|---|
| 754 | --indent;
|
|---|
| [a7d50b6] | 755 |
|
|---|
| [461046f] | 756 | return node;
|
|---|
| 757 | }
|
|---|
| 758 |
|
|---|
| [400b8be] | 759 | virtual const ast::FinallyClause * visit( const ast::FinallyClause * node ) override final {
|
|---|
| [6f4b7f2] | 760 | os << "Finally Statement" << endl;
|
|---|
| 761 | os << indent << "... with block:" << endl;
|
|---|
| 762 | ++indent;
|
|---|
| 763 | os << indent;
|
|---|
| 764 | safe_print( node->body );
|
|---|
| 765 | --indent;
|
|---|
| 766 |
|
|---|
| [461046f] | 767 | return node;
|
|---|
| 768 | }
|
|---|
| 769 |
|
|---|
| [37cdd97] | 770 | virtual const ast::Stmt * visit( const ast::SuspendStmt * node ) override final {
|
|---|
| 771 | os << "Suspend Statement";
|
|---|
| [835d6e8] | 772 | switch (node->kind) {
|
|---|
| 773 | case ast::SuspendStmt::None : os << " with implicit target"; break;
|
|---|
| 774 | case ast::SuspendStmt::Generator: os << " for generator"; break;
|
|---|
| 775 | case ast::SuspendStmt::Coroutine: os << " for coroutine"; break;
|
|---|
| [37cdd97] | 776 | }
|
|---|
| 777 | os << endl;
|
|---|
| 778 |
|
|---|
| 779 | ++indent;
|
|---|
| 780 | if(node->then) {
|
|---|
| 781 | os << indent << " with post statement :" << endl;
|
|---|
| 782 | safe_print( node->then );
|
|---|
| 783 | }
|
|---|
| 784 | ++indent;
|
|---|
| 785 |
|
|---|
| 786 | return node;
|
|---|
| 787 | }
|
|---|
| 788 |
|
|---|
| [c86b08d] | 789 | virtual const ast::WhenClause * visit( const ast::WhenClause * node ) override final {
|
|---|
| 790 | os << indent-1 << "target: ";
|
|---|
| 791 | safe_print( node->target );
|
|---|
| 792 |
|
|---|
| 793 | if ( node->stmt ) {
|
|---|
| 794 | os << indent-1 << "... with statment:" << endl;
|
|---|
| 795 | node->stmt->accept( *this );
|
|---|
| 796 | }
|
|---|
| 797 |
|
|---|
| 798 | if ( node->when_cond ) {
|
|---|
| 799 | os << indent-1 << "... with when condition:" << endl;
|
|---|
| 800 | node->when_cond->accept( *this );
|
|---|
| 801 | }
|
|---|
| 802 |
|
|---|
| 803 | return node;
|
|---|
| 804 | }
|
|---|
| 805 |
|
|---|
| [e67991f] | 806 | virtual const ast::Stmt * visit( const ast::WaitForStmt * node ) override final {
|
|---|
| [6f4b7f2] | 807 | os << "Waitfor Statement" << endl;
|
|---|
| 808 | indent += 2;
|
|---|
| 809 | for( const auto & clause : node->clauses ) {
|
|---|
| [f6e6a55] | 810 | clause->accept( *this );
|
|---|
| 811 | }
|
|---|
| [a7d50b6] | 812 |
|
|---|
| [f6e6a55] | 813 | if ( node->timeout_time ) {
|
|---|
| 814 | os << indent-1 << "timeout of:" << endl;
|
|---|
| 815 | node->timeout_time->accept( *this );
|
|---|
| [6f4b7f2] | 816 |
|
|---|
| [f6e6a55] | 817 | if ( node->timeout_stmt ) {
|
|---|
| [6f4b7f2] | 818 | os << indent-1 << "... with statment:" << endl;
|
|---|
| [f6e6a55] | 819 | node->timeout_stmt->accept( *this );
|
|---|
| [6f4b7f2] | 820 | }
|
|---|
| 821 |
|
|---|
| [f6e6a55] | 822 | if ( node->timeout_cond ) {
|
|---|
| [6f4b7f2] | 823 | os << indent-1 << "... with condition:" << endl;
|
|---|
| [f6e6a55] | 824 | node->timeout_cond->accept( *this );
|
|---|
| [6f4b7f2] | 825 | }
|
|---|
| 826 | }
|
|---|
| 827 |
|
|---|
| [f6e6a55] | 828 | if ( node->else_stmt ) {
|
|---|
| 829 | os << indent-1 << "else:" << endl;
|
|---|
| 830 | node->else_stmt->accept( *this );
|
|---|
| [6f4b7f2] | 831 |
|
|---|
| [f6e6a55] | 832 | if ( node->else_cond ) {
|
|---|
| [6f4b7f2] | 833 | os << indent-1 << "... with condition:" << endl;
|
|---|
| [f6e6a55] | 834 | node->else_cond->accept( *this );
|
|---|
| [6f4b7f2] | 835 | }
|
|---|
| 836 | }
|
|---|
| 837 |
|
|---|
| [f6e6a55] | 838 | return node;
|
|---|
| 839 | }
|
|---|
| [6f4b7f2] | 840 |
|
|---|
| [f6e6a55] | 841 | virtual const ast::WaitForClause * visit( const ast::WaitForClause * node ) override final {
|
|---|
| 842 | os << indent-1 << "target function: ";
|
|---|
| [c86b08d] | 843 | safe_print( node->target );
|
|---|
| [f6e6a55] | 844 |
|
|---|
| 845 | if ( !node->target_args.empty() ) {
|
|---|
| 846 | os << endl << indent-1 << "... with arguments:" << endl;
|
|---|
| 847 | for( const ast::Expr * arg : node->target_args ) {
|
|---|
| 848 | arg->accept( *this );
|
|---|
| [6f4b7f2] | 849 | }
|
|---|
| 850 | }
|
|---|
| [f6e6a55] | 851 |
|
|---|
| 852 | if ( node->stmt ) {
|
|---|
| 853 | os << indent-1 << "... with statment:" << endl;
|
|---|
| 854 | node->stmt->accept( *this );
|
|---|
| 855 | }
|
|---|
| 856 |
|
|---|
| [c86b08d] | 857 | if ( node->when_cond ) {
|
|---|
| [f6e6a55] | 858 | os << indent-1 << "... with condition:" << endl;
|
|---|
| [c86b08d] | 859 | node->when_cond->accept( *this );
|
|---|
| [f6e6a55] | 860 | }
|
|---|
| [6f4b7f2] | 861 |
|
|---|
| [461046f] | 862 | return node;
|
|---|
| 863 | }
|
|---|
| 864 |
|
|---|
| [cf3da24] | 865 | virtual const ast::Stmt * visit( const ast::WaitUntilStmt * node ) override final {
|
|---|
| [c86b08d] | 866 | os << "Waituntil Statement" << endl;
|
|---|
| 867 | indent += 2;
|
|---|
| 868 | for( const auto & clause : node->clauses ) {
|
|---|
| 869 | clause->accept( *this );
|
|---|
| 870 | }
|
|---|
| [cf3da24] | 871 | // calls print( const ast::WaitStmt * node )
|
|---|
| 872 | print(node);
|
|---|
| [c86b08d] | 873 | return node;
|
|---|
| 874 | }
|
|---|
| 875 |
|
|---|
| [e67991f] | 876 | virtual const ast::Decl * visit( const ast::WithStmt * node ) override final {
|
|---|
| [6f4b7f2] | 877 | os << "With statement" << endl;
|
|---|
| 878 | os << indent << "... with expressions:" << endl;
|
|---|
| 879 | ++indent;
|
|---|
| 880 | printAll( node->exprs );
|
|---|
| 881 | os << indent-1 << "... with statement:" << endl << indent;
|
|---|
| 882 | safe_print( node->stmt );
|
|---|
| 883 | --indent;
|
|---|
| 884 |
|
|---|
| [461046f] | 885 | return node;
|
|---|
| 886 | }
|
|---|
| 887 |
|
|---|
| [e67991f] | 888 | virtual const ast::NullStmt * visit( const ast::NullStmt * node ) override final {
|
|---|
| [94b1f718] | 889 | os << "Null Statement" << endl;
|
|---|
| 890 | print( node->labels );
|
|---|
| 891 |
|
|---|
| [461046f] | 892 | return node;
|
|---|
| 893 | }
|
|---|
| 894 |
|
|---|
| [e67991f] | 895 | virtual const ast::Stmt * visit( const ast::DeclStmt * node ) override final {
|
|---|
| [6f4b7f2] | 896 | os << "Declaration of ";
|
|---|
| 897 | safe_print( node->decl );
|
|---|
| 898 |
|
|---|
| [461046f] | 899 | return node;
|
|---|
| 900 | }
|
|---|
| 901 |
|
|---|
| [e67991f] | 902 | virtual const ast::Stmt * visit( const ast::ImplicitCtorDtorStmt * node ) override final {
|
|---|
| [6f4b7f2] | 903 | os << "Implicit Ctor Dtor Statement" << endl;
|
|---|
| 904 | os << indent << "... with Ctor/Dtor: ";
|
|---|
| 905 | ++indent;
|
|---|
| 906 | safe_print( node->callStmt );
|
|---|
| 907 | --indent;
|
|---|
| 908 | os << endl;
|
|---|
| 909 |
|
|---|
| [461046f] | 910 | return node;
|
|---|
| 911 | }
|
|---|
| 912 |
|
|---|
| [6cebfef] | 913 | virtual const ast::Stmt * visit( const ast::MutexStmt * node ) override final {
|
|---|
| 914 | os << "Mutex Statement" << endl;
|
|---|
| 915 | os << indent << "... with Mutex Parameters: ";
|
|---|
| 916 | ++indent;
|
|---|
| 917 | printAll( node->mutexObjs );
|
|---|
| 918 | --indent;
|
|---|
| 919 | os << indent << "... with Statement: ";
|
|---|
| 920 | ++indent;
|
|---|
| 921 | safe_print( node->stmt );
|
|---|
| 922 | --indent;
|
|---|
| 923 | os << endl;
|
|---|
| 924 |
|
|---|
| 925 | return node;
|
|---|
| 926 | }
|
|---|
| 927 |
|
|---|
| [cf3da24] | 928 | virtual const ast::Stmt * visit( const ast::CorunStmt * node ) override final {
|
|---|
| [eb779d5] | 929 | os << "Corun Statement" << endl;
|
|---|
| 930 | os << indent << "... with Statement: ";
|
|---|
| 931 | ++indent;
|
|---|
| 932 | safe_print( node->stmt );
|
|---|
| 933 | --indent;
|
|---|
| 934 | os << endl;
|
|---|
| 935 |
|
|---|
| 936 | return node;
|
|---|
| 937 | }
|
|---|
| 938 |
|
|---|
| [3d9d017] | 939 | virtual const ast::Stmt * visit( const ast::CoforStmt * node ) override final {
|
|---|
| 940 | os << "Cofor Statement" << endl;
|
|---|
| 941 |
|
|---|
| 942 | if ( ! node->inits.empty() ) {
|
|---|
| 943 | os << indent << "... initialization:" << endl;
|
|---|
| 944 | ++indent;
|
|---|
| 945 | for ( const ast::Stmt * stmt : node->inits ) {
|
|---|
| 946 | os << indent+1;
|
|---|
| 947 | safe_print( stmt );
|
|---|
| 948 | }
|
|---|
| 949 | --indent;
|
|---|
| 950 | }
|
|---|
| 951 |
|
|---|
| 952 | if ( node->cond ) {
|
|---|
| 953 | os << indent << "... condition:" << endl;
|
|---|
| 954 | ++indent;
|
|---|
| 955 | os << indent;
|
|---|
| 956 | node->cond->accept( *this );
|
|---|
| 957 | --indent;
|
|---|
| 958 | }
|
|---|
| 959 |
|
|---|
| 960 | if ( node->inc ) {
|
|---|
| 961 | os << indent << "... increment:" << endl;
|
|---|
| 962 | ++indent;
|
|---|
| 963 | os << indent;
|
|---|
| 964 | node->inc->accept( *this );
|
|---|
| 965 | --indent;
|
|---|
| 966 | }
|
|---|
| 967 |
|
|---|
| 968 | if ( node->body ) {
|
|---|
| 969 | os << indent << "... with body:" << endl;
|
|---|
| 970 | ++indent;
|
|---|
| 971 | os << indent;
|
|---|
| 972 | node->body->accept( *this );
|
|---|
| 973 | --indent;
|
|---|
| 974 | }
|
|---|
| 975 | os << endl;
|
|---|
| 976 | print( node->labels );
|
|---|
| 977 |
|
|---|
| 978 | return node;
|
|---|
| 979 | }
|
|---|
| 980 |
|
|---|
| [e67991f] | 981 | virtual const ast::Expr * visit( const ast::ApplicationExpr * node ) override final {
|
|---|
| [20a5977] | 982 | ++indent;
|
|---|
| [94b1f718] | 983 | os << "Application of" << endl << indent;
|
|---|
| [20a5977] | 984 | safe_print( node->func );
|
|---|
| [94b1f718] | 985 | os << endl;
|
|---|
| [20a5977] | 986 | if ( ! node->args.empty() ) {
|
|---|
| [94b1f718] | 987 | os << indent << "... to arguments" << endl;
|
|---|
| [20a5977] | 988 | printAll( node->args );
|
|---|
| 989 | }
|
|---|
| 990 | --indent;
|
|---|
| 991 | postprint( node );
|
|---|
| 992 |
|
|---|
| [461046f] | 993 | return node;
|
|---|
| 994 | }
|
|---|
| 995 |
|
|---|
| [e67991f] | 996 | virtual const ast::Expr * visit( const ast::UntypedExpr * node ) override final {
|
|---|
| [20a5977] | 997 | ++indent;
|
|---|
| [94b1f718] | 998 | os << "Applying untyped:" << endl;
|
|---|
| [20a5977] | 999 | os << indent;
|
|---|
| 1000 | safe_print( node->func );
|
|---|
| [94b1f718] | 1001 | os << endl << indent-1 << "...to:" << endl;
|
|---|
| [20a5977] | 1002 | printAll( node->args );
|
|---|
| 1003 | --indent;
|
|---|
| 1004 | postprint( node );
|
|---|
| 1005 |
|
|---|
| [461046f] | 1006 | return node;
|
|---|
| 1007 | }
|
|---|
| 1008 |
|
|---|
| [e67991f] | 1009 | virtual const ast::Expr * visit( const ast::NameExpr * node ) override final {
|
|---|
| [20a5977] | 1010 | os << "Name: " << node->name;
|
|---|
| 1011 | postprint( node );
|
|---|
| [d908563] | 1012 |
|
|---|
| [461046f] | 1013 | return node;
|
|---|
| 1014 | }
|
|---|
| 1015 |
|
|---|
| [b0d9ff7] | 1016 | virtual const ast::Expr * visit( const ast::QualifiedNameExpr * node ) override final {
|
|---|
| 1017 | os << "QualifiedNameExpr: " << std::endl;
|
|---|
| 1018 | os << ++indent << "Type: ";
|
|---|
| 1019 | safe_print( node->type_decl );
|
|---|
| 1020 | os << std::endl;
|
|---|
| 1021 | os << indent << "Name: " << node->name << std::endl;
|
|---|
| 1022 | --indent;
|
|---|
| 1023 | postprint( node );
|
|---|
| 1024 | return node;
|
|---|
| 1025 | }
|
|---|
| 1026 |
|
|---|
| [e67991f] | 1027 | virtual const ast::Expr * visit( const ast::AddressExpr * node ) override final {
|
|---|
| [94b1f718] | 1028 | os << "Address of:" << endl;
|
|---|
| [20a5977] | 1029 | ++indent;
|
|---|
| 1030 | os << indent;
|
|---|
| 1031 | safe_print( node->arg );
|
|---|
| 1032 |
|
|---|
| 1033 | --indent;
|
|---|
| 1034 |
|
|---|
| [461046f] | 1035 | return node;
|
|---|
| 1036 | }
|
|---|
| 1037 |
|
|---|
| [e67991f] | 1038 | virtual const ast::Expr * visit( const ast::LabelAddressExpr * node ) override final {
|
|---|
| [20a5977] | 1039 | os << "Address of label:" << node->arg;
|
|---|
| 1040 |
|
|---|
| [461046f] | 1041 | return node;
|
|---|
| 1042 | }
|
|---|
| 1043 |
|
|---|
| [e67991f] | 1044 | virtual const ast::Expr * visit( const ast::CastExpr * node ) override final {
|
|---|
| [20a5977] | 1045 | ++indent;
|
|---|
| [a8ed717] | 1046 | os << (node->isGenerated ? "Generated" : "Explicit") << " Cast of:" << endl << indent;
|
|---|
| [20a5977] | 1047 | safe_print( node->arg );
|
|---|
| [94b1f718] | 1048 | os << endl << indent-1 << "... to:";
|
|---|
| [20a5977] | 1049 | if ( ! node->result ) {
|
|---|
| 1050 | os << " ";
|
|---|
| 1051 | undefined();
|
|---|
| 1052 | } else if ( node->result->isVoid() ) {
|
|---|
| 1053 | os << " nothing";
|
|---|
| 1054 | } else {
|
|---|
| [94b1f718] | 1055 | os << endl << indent;
|
|---|
| [20a5977] | 1056 | node->result->accept( *this );
|
|---|
| 1057 | } // if
|
|---|
| 1058 | --indent;
|
|---|
| 1059 | postprint( node );
|
|---|
| 1060 |
|
|---|
| [461046f] | 1061 | return node;
|
|---|
| 1062 | }
|
|---|
| 1063 |
|
|---|
| [e67991f] | 1064 | virtual const ast::Expr * visit( const ast::KeywordCastExpr * node ) override final {
|
|---|
| [20a5977] | 1065 | ++indent;
|
|---|
| [94b1f718] | 1066 | os << "Keyword Cast of:" << endl << indent;
|
|---|
| [20a5977] | 1067 | safe_print( node->arg );
|
|---|
| 1068 | --indent;
|
|---|
| [94b1f718] | 1069 | os << endl << indent << "... to: " << node->targetString();
|
|---|
| [20a5977] | 1070 | postprint( node );
|
|---|
| 1071 |
|
|---|
| [461046f] | 1072 | return node;
|
|---|
| 1073 | }
|
|---|
| 1074 |
|
|---|
| [e67991f] | 1075 | virtual const ast::Expr * visit( const ast::VirtualCastExpr * node ) override final {
|
|---|
| [20a5977] | 1076 | ++indent;
|
|---|
| [94b1f718] | 1077 | os << "Virtual Cast of:" << endl << indent;
|
|---|
| [20a5977] | 1078 | safe_print( node->arg );
|
|---|
| [94b1f718] | 1079 | os << endl << indent-1 << "... to:";
|
|---|
| [20a5977] | 1080 | if ( ! node->result ) {
|
|---|
| 1081 | os << " unknown";
|
|---|
| 1082 | } else {
|
|---|
| [94b1f718] | 1083 | os << endl << indent;
|
|---|
| [20a5977] | 1084 | node->result->accept( *this );
|
|---|
| 1085 | }
|
|---|
| 1086 | --indent;
|
|---|
| 1087 | postprint( node );
|
|---|
| 1088 |
|
|---|
| [461046f] | 1089 | return node;
|
|---|
| 1090 | }
|
|---|
| 1091 |
|
|---|
| [e67991f] | 1092 | virtual const ast::Expr * visit( const ast::UntypedMemberExpr * node ) override final {
|
|---|
| [20a5977] | 1093 | ++indent;
|
|---|
| [94b1f718] | 1094 | os << "Untyped Member Expression, with field: " << endl << indent;
|
|---|
| [20a5977] | 1095 | safe_print( node->member );
|
|---|
| [94b1f718] | 1096 | os << indent-1 << "... from aggregate:" << endl << indent;
|
|---|
| [20a5977] | 1097 | safe_print( node->aggregate );
|
|---|
| 1098 | --indent;
|
|---|
| 1099 | postprint( node );
|
|---|
| 1100 |
|
|---|
| [461046f] | 1101 | return node;
|
|---|
| 1102 | }
|
|---|
| 1103 |
|
|---|
| [e67991f] | 1104 | virtual const ast::Expr * visit( const ast::MemberExpr * node ) override final {
|
|---|
| [20a5977] | 1105 | ++indent;
|
|---|
| [94b1f718] | 1106 | os << "Member Expression, with field:" << endl << indent;
|
|---|
| [20a5977] | 1107 | safe_print( node->member );
|
|---|
| [94b1f718] | 1108 | os << endl << indent-1 << "... from aggregate:" << endl << indent;
|
|---|
| [20a5977] | 1109 | safe_print( node->aggregate );
|
|---|
| 1110 | --indent;
|
|---|
| 1111 | postprint( node );
|
|---|
| 1112 |
|
|---|
| [461046f] | 1113 | return node;
|
|---|
| 1114 | }
|
|---|
| 1115 |
|
|---|
| [e67991f] | 1116 | virtual const ast::Expr * visit( const ast::VariableExpr * node ) override final {
|
|---|
| [20a5977] | 1117 | os << "Variable Expression: ";
|
|---|
| 1118 | short_print( node->var );
|
|---|
| 1119 | postprint( node );
|
|---|
| 1120 |
|
|---|
| [461046f] | 1121 | return node;
|
|---|
| 1122 | }
|
|---|
| 1123 |
|
|---|
| [e67991f] | 1124 | virtual const ast::Expr * visit( const ast::ConstantExpr * node ) override final {
|
|---|
| [20a5977] | 1125 | os << "Constant Expression (" << node->rep;
|
|---|
| 1126 | if ( node->result ) {
|
|---|
| 1127 | os << ": ";
|
|---|
| 1128 | node->result->accept( *this );
|
|---|
| 1129 | }
|
|---|
| 1130 | os << ")";
|
|---|
| 1131 | postprint( node );
|
|---|
| 1132 |
|
|---|
| [461046f] | 1133 | return node;
|
|---|
| 1134 | }
|
|---|
| 1135 |
|
|---|
| [e67991f] | 1136 | virtual const ast::Expr * visit( const ast::SizeofExpr * node ) override final {
|
|---|
| [a16e246] | 1137 | os << "Sizeof Expression on: ";
|
|---|
| 1138 | ++indent;
|
|---|
| 1139 | if ( node->type ) node->type->accept( *this );
|
|---|
| 1140 | else safe_print( node->expr );
|
|---|
| 1141 | --indent;
|
|---|
| 1142 | postprint( node );
|
|---|
| 1143 |
|
|---|
| [461046f] | 1144 | return node;
|
|---|
| 1145 | }
|
|---|
| 1146 |
|
|---|
| [e67991f] | 1147 | virtual const ast::Expr * visit( const ast::AlignofExpr * node ) override final {
|
|---|
| [a16e246] | 1148 | os << "Alignof Expression on: ";
|
|---|
| 1149 | ++indent;
|
|---|
| 1150 | if ( node->type ) node->type->accept( *this );
|
|---|
| 1151 | else safe_print( node->expr );
|
|---|
| 1152 | --indent;
|
|---|
| 1153 | postprint( node );
|
|---|
| [d908563] | 1154 |
|
|---|
| [461046f] | 1155 | return node;
|
|---|
| 1156 | }
|
|---|
| 1157 |
|
|---|
| [e67991f] | 1158 | virtual const ast::Expr * visit( const ast::UntypedOffsetofExpr * node ) override final {
|
|---|
| [a16e246] | 1159 | os << "Untyped Offsetof Expression on member " << node->member << " of ";
|
|---|
| 1160 | ++indent;
|
|---|
| 1161 | safe_print( node->type );
|
|---|
| 1162 | --indent;
|
|---|
| 1163 | postprint( node );
|
|---|
| 1164 |
|
|---|
| [461046f] | 1165 | return node;
|
|---|
| 1166 | }
|
|---|
| 1167 |
|
|---|
| [e67991f] | 1168 | virtual const ast::Expr * visit( const ast::OffsetofExpr * node ) override final {
|
|---|
| [a16e246] | 1169 | os << "Offsetof Expression on member " << node->member->name << " of ";
|
|---|
| 1170 | ++indent;
|
|---|
| 1171 | safe_print( node->type );
|
|---|
| 1172 | --indent;
|
|---|
| 1173 | postprint( node );
|
|---|
| 1174 |
|
|---|
| [461046f] | 1175 | return node;
|
|---|
| 1176 | }
|
|---|
| 1177 |
|
|---|
| [e67991f] | 1178 | virtual const ast::Expr * visit( const ast::OffsetPackExpr * node ) override final {
|
|---|
| [a16e246] | 1179 | os << "Offset Pack Expression on: ";
|
|---|
| 1180 | ++indent;
|
|---|
| 1181 | safe_print( node->type );
|
|---|
| 1182 | --indent;
|
|---|
| 1183 | postprint( node );
|
|---|
| 1184 |
|
|---|
| [461046f] | 1185 | return node;
|
|---|
| 1186 | }
|
|---|
| 1187 |
|
|---|
| [59c8dff] | 1188 | virtual const ast::Expr * visit( const ast::EnumPosExpr * node ) override final {
|
|---|
| 1189 | os << "Enum Position Expression on: ";
|
|---|
| 1190 | ++indent;
|
|---|
| 1191 | safe_print( node->type );
|
|---|
| 1192 | --indent;
|
|---|
| 1193 | postprint( node );
|
|---|
| 1194 | return node;
|
|---|
| 1195 | }
|
|---|
| 1196 |
|
|---|
| [e67991f] | 1197 | virtual const ast::Expr * visit( const ast::LogicalExpr * node ) override final {
|
|---|
| [a16e246] | 1198 | os << "Short-circuited operation (" << (node->isAnd ? "and" : "or") << ") on: ";
|
|---|
| 1199 | safe_print( node->arg1 );
|
|---|
| 1200 | os << " and ";
|
|---|
| 1201 | safe_print( node->arg2 );
|
|---|
| 1202 | postprint( node );
|
|---|
| 1203 |
|
|---|
| [461046f] | 1204 | return node;
|
|---|
| 1205 | }
|
|---|
| 1206 |
|
|---|
| [e67991f] | 1207 | virtual const ast::Expr * visit( const ast::ConditionalExpr * node ) override final {
|
|---|
| [a16e246] | 1208 | ++indent;
|
|---|
| [94b1f718] | 1209 | os << "Conditional expression on:" << endl << indent;
|
|---|
| [a16e246] | 1210 | safe_print( node->arg1 );
|
|---|
| [94b1f718] | 1211 | os << indent-1 << "First alternative:" << endl << indent;
|
|---|
| [a16e246] | 1212 | safe_print( node->arg2 );
|
|---|
| [94b1f718] | 1213 | os << indent-1 << "Second alternative:" << endl << indent;
|
|---|
| [a16e246] | 1214 | safe_print( node->arg3 );
|
|---|
| 1215 | --indent;
|
|---|
| 1216 | postprint( node );
|
|---|
| 1217 |
|
|---|
| [461046f] | 1218 | return node;
|
|---|
| 1219 | }
|
|---|
| 1220 |
|
|---|
| [e67991f] | 1221 | virtual const ast::Expr * visit( const ast::CommaExpr * node ) override final {
|
|---|
| [a16e246] | 1222 | ++indent;
|
|---|
| [94b1f718] | 1223 | os << "Comma Expression:" << endl << indent;
|
|---|
| [a16e246] | 1224 | safe_print( node->arg1 );
|
|---|
| [94b1f718] | 1225 | os << endl << indent;
|
|---|
| [a16e246] | 1226 | safe_print( node->arg2 );
|
|---|
| 1227 | --indent;
|
|---|
| 1228 | postprint( node );
|
|---|
| 1229 |
|
|---|
| [461046f] | 1230 | return node;
|
|---|
| 1231 | }
|
|---|
| 1232 |
|
|---|
| [e67991f] | 1233 | virtual const ast::Expr * visit( const ast::TypeExpr * node ) override final {
|
|---|
| [a16e246] | 1234 | safe_print( node->type );
|
|---|
| 1235 | postprint( node );
|
|---|
| 1236 |
|
|---|
| [461046f] | 1237 | return node;
|
|---|
| 1238 | }
|
|---|
| 1239 |
|
|---|
| [4ec9513] | 1240 | virtual const ast::Expr * visit( const ast::DimensionExpr * node ) override final {
|
|---|
| 1241 | os << "Type-Sys Value: " << node->name;
|
|---|
| 1242 | postprint( node );
|
|---|
| 1243 |
|
|---|
| 1244 | return node;
|
|---|
| 1245 | }
|
|---|
| 1246 |
|
|---|
| [e67991f] | 1247 | virtual const ast::Expr * visit( const ast::AsmExpr * node ) override final {
|
|---|
| [94b1f718] | 1248 | os << "Asm Expression:" << endl;
|
|---|
| [a16e246] | 1249 | ++indent;
|
|---|
| [665f432] | 1250 | if ( !node->inout.empty() ) os << "[" << node->inout << "] ";
|
|---|
| [a16e246] | 1251 | if ( node->constraint ) node->constraint->accept( *this );
|
|---|
| 1252 | if ( node->operand ) node->operand->accept( *this );
|
|---|
| 1253 | --indent;
|
|---|
| [d908563] | 1254 |
|
|---|
| [461046f] | 1255 | return node;
|
|---|
| 1256 | }
|
|---|
| 1257 |
|
|---|
| [e67991f] | 1258 | virtual const ast::Expr * visit( const ast::ImplicitCopyCtorExpr * node ) override final {
|
|---|
| [a16e246] | 1259 | ++indent;
|
|---|
| [94b1f718] | 1260 | os << "Implicit Copy Constructor Expression:" << endl << indent;
|
|---|
| [a16e246] | 1261 | safe_print( node->callExpr );
|
|---|
| 1262 | --indent;
|
|---|
| 1263 | postprint( node );
|
|---|
| 1264 |
|
|---|
| [461046f] | 1265 | return node;
|
|---|
| 1266 | }
|
|---|
| 1267 |
|
|---|
| [e67991f] | 1268 | virtual const ast::Expr * visit( const ast::ConstructorExpr * node ) override final {
|
|---|
| [94b1f718] | 1269 | os << "Constructor Expression:" << endl << indent+1;
|
|---|
| [a16e246] | 1270 | indent += 2;
|
|---|
| 1271 | safe_print( node->callExpr );
|
|---|
| 1272 | indent -= 2;
|
|---|
| 1273 | postprint( node );
|
|---|
| 1274 |
|
|---|
| [461046f] | 1275 | return node;
|
|---|
| 1276 | }
|
|---|
| 1277 |
|
|---|
| [e67991f] | 1278 | virtual const ast::Expr * visit( const ast::CompoundLiteralExpr * node ) override final {
|
|---|
| [a16e246] | 1279 | ++indent;
|
|---|
| [94b1f718] | 1280 | os << "Compound Literal Expression: " << endl << indent;
|
|---|
| [a16e246] | 1281 | safe_print( node->result );
|
|---|
| 1282 | os << indent;
|
|---|
| 1283 | safe_print( node->init );
|
|---|
| 1284 | --indent;
|
|---|
| 1285 | postprint( node );
|
|---|
| 1286 |
|
|---|
| [461046f] | 1287 | return node;
|
|---|
| 1288 | }
|
|---|
| 1289 |
|
|---|
| [e67991f] | 1290 | virtual const ast::Expr * visit( const ast::RangeExpr * node ) override final {
|
|---|
| [a16e246] | 1291 | os << "Range Expression: ";
|
|---|
| 1292 | safe_print( node->low );
|
|---|
| 1293 | os << " ... ";
|
|---|
| 1294 | safe_print( node->high );
|
|---|
| 1295 | postprint( node );
|
|---|
| 1296 |
|
|---|
| [461046f] | 1297 | return node;
|
|---|
| 1298 | }
|
|---|
| 1299 |
|
|---|
| [e67991f] | 1300 | virtual const ast::Expr * visit( const ast::UntypedTupleExpr * node ) override final {
|
|---|
| [94b1f718] | 1301 | os << "Untyped Tuple:" << endl;
|
|---|
| [a16e246] | 1302 | ++indent;
|
|---|
| 1303 | printAll( node->exprs );
|
|---|
| 1304 | --indent;
|
|---|
| 1305 | postprint( node );
|
|---|
| 1306 |
|
|---|
| [461046f] | 1307 | return node;
|
|---|
| 1308 | }
|
|---|
| 1309 |
|
|---|
| [e67991f] | 1310 | virtual const ast::Expr * visit( const ast::TupleExpr * node ) override final {
|
|---|
| [94b1f718] | 1311 | os << "Tuple:" << endl;
|
|---|
| [a16e246] | 1312 | ++indent;
|
|---|
| 1313 | printAll( node->exprs );
|
|---|
| 1314 | --indent;
|
|---|
| 1315 | postprint( node );
|
|---|
| 1316 |
|
|---|
| [461046f] | 1317 | return node;
|
|---|
| 1318 | }
|
|---|
| 1319 |
|
|---|
| [e67991f] | 1320 | virtual const ast::Expr * visit( const ast::TupleIndexExpr * node ) override final {
|
|---|
| [94b1f718] | 1321 | os << "Tuple Index Expression, with tuple:" << endl;
|
|---|
| [a16e246] | 1322 | ++indent;
|
|---|
| 1323 | os << indent;
|
|---|
| 1324 | safe_print( node->tuple );
|
|---|
| [94b1f718] | 1325 | os << indent << "with index: " << node->index << endl;
|
|---|
| [a16e246] | 1326 | --indent;
|
|---|
| 1327 | postprint( node );
|
|---|
| [d908563] | 1328 |
|
|---|
| [461046f] | 1329 | return node;
|
|---|
| 1330 | }
|
|---|
| 1331 |
|
|---|
| [e67991f] | 1332 | virtual const ast::Expr * visit( const ast::TupleAssignExpr * node ) override final {
|
|---|
| [94b1f718] | 1333 | os << "Tuple Assignment Expression, with stmt expr:" << endl;
|
|---|
| [a16e246] | 1334 | ++indent;
|
|---|
| 1335 | os << indent;
|
|---|
| 1336 | safe_print( node->stmtExpr );
|
|---|
| 1337 | --indent;
|
|---|
| 1338 | postprint( node );
|
|---|
| 1339 |
|
|---|
| [461046f] | 1340 | return node;
|
|---|
| 1341 | }
|
|---|
| 1342 |
|
|---|
| [e67991f] | 1343 | virtual const ast::Expr * visit( const ast::StmtExpr * node ) override final {
|
|---|
| [a16e246] | 1344 | ++indent;
|
|---|
| [94b1f718] | 1345 | os << "Statement Expression:" << endl << indent;
|
|---|
| [a16e246] | 1346 | safe_print( node->stmts );
|
|---|
| 1347 | if ( ! node->returnDecls.empty() ) {
|
|---|
| 1348 | os << indent << "... with returnDecls: ";
|
|---|
| 1349 | printAll( node->returnDecls );
|
|---|
| 1350 | }
|
|---|
| 1351 | if ( ! node->dtors.empty() ) {
|
|---|
| 1352 | os << indent << "... with dtors: ";
|
|---|
| 1353 | printAll( node->dtors );
|
|---|
| 1354 | }
|
|---|
| 1355 | --indent;
|
|---|
| 1356 | postprint( node );
|
|---|
| 1357 |
|
|---|
| [461046f] | 1358 | return node;
|
|---|
| 1359 | }
|
|---|
| 1360 |
|
|---|
| [e67991f] | 1361 | virtual const ast::Expr * visit( const ast::UniqueExpr * node ) override final {
|
|---|
| [a16e246] | 1362 | ++indent;
|
|---|
| [94b1f718] | 1363 | os << "Unique Expression with id: " << node->id << endl << indent;
|
|---|
| [a16e246] | 1364 | safe_print( node->expr );
|
|---|
| 1365 | if ( node->object ) {
|
|---|
| 1366 | os << indent-1 << "... with decl: ";
|
|---|
| 1367 | short_print( node->object );
|
|---|
| 1368 | }
|
|---|
| 1369 | --indent;
|
|---|
| 1370 | postprint( node );
|
|---|
| 1371 |
|
|---|
| [461046f] | 1372 | return node;
|
|---|
| 1373 | }
|
|---|
| 1374 |
|
|---|
| [e67991f] | 1375 | virtual const ast::Expr * visit( const ast::UntypedInitExpr * node ) override final {
|
|---|
| [a16e246] | 1376 | ++indent;
|
|---|
| [94b1f718] | 1377 | os << "Untyped Init Expression" << endl << indent;
|
|---|
| [a16e246] | 1378 | safe_print( node->expr );
|
|---|
| 1379 | if ( ! node->initAlts.empty() ) {
|
|---|
| 1380 | for ( const InitAlternative & alt : node->initAlts ) {
|
|---|
| 1381 | os << indent << "InitAlternative: ";
|
|---|
| 1382 | safe_print( alt.type );
|
|---|
| 1383 | safe_print( alt.designation );
|
|---|
| 1384 | }
|
|---|
| 1385 | }
|
|---|
| 1386 | --indent;
|
|---|
| 1387 |
|
|---|
| [461046f] | 1388 | return node;
|
|---|
| 1389 | }
|
|---|
| 1390 |
|
|---|
| [e67991f] | 1391 | virtual const ast::Expr * visit( const ast::InitExpr * node ) override final {
|
|---|
| [a16e246] | 1392 | ++indent;
|
|---|
| [94b1f718] | 1393 | os << "Init Expression" << endl << indent;
|
|---|
| [a16e246] | 1394 | safe_print( node->expr );
|
|---|
| 1395 | os << indent << "... with designation: ";
|
|---|
| 1396 | safe_print( node->designation );
|
|---|
| 1397 | --indent;
|
|---|
| 1398 |
|
|---|
| [461046f] | 1399 | return node;
|
|---|
| 1400 | }
|
|---|
| 1401 |
|
|---|
| [e67991f] | 1402 | virtual const ast::Expr * visit( const ast::DeletedExpr * node ) override final {
|
|---|
| [a16e246] | 1403 | ++indent;
|
|---|
| [94b1f718] | 1404 | os << "Deleted Expression" << endl << indent;
|
|---|
| [a16e246] | 1405 | safe_print( node->expr );
|
|---|
| [94b1f718] | 1406 | os << endl << indent << "... deleted by: ";
|
|---|
| [a16e246] | 1407 | safe_print( node->deleteStmt );
|
|---|
| 1408 | --indent;
|
|---|
| 1409 |
|
|---|
| [461046f] | 1410 | return node;
|
|---|
| 1411 | }
|
|---|
| 1412 |
|
|---|
| [e67991f] | 1413 | virtual const ast::Expr * visit( const ast::DefaultArgExpr * node ) override final {
|
|---|
| [a16e246] | 1414 | ++indent;
|
|---|
| [94b1f718] | 1415 | os << "Default Argument Expression" << endl << indent;
|
|---|
| [a16e246] | 1416 | safe_print( node->expr );
|
|---|
| 1417 | --indent;
|
|---|
| 1418 |
|
|---|
| [461046f] | 1419 | return node;
|
|---|
| 1420 | }
|
|---|
| 1421 |
|
|---|
| [e67991f] | 1422 | virtual const ast::Expr * visit( const ast::GenericExpr * node ) override final {
|
|---|
| [a16e246] | 1423 | ++indent;
|
|---|
| [94b1f718] | 1424 | os << "C11 _Generic Expression" << endl << indent;
|
|---|
| [a16e246] | 1425 | safe_print( node->control );
|
|---|
| [94b1f718] | 1426 | os << endl << indent << "... with associations:" << endl;
|
|---|
| [a16e246] | 1427 | for ( const auto & assoc : node->associations ) {
|
|---|
| 1428 | os << indent;
|
|---|
| 1429 | if ( assoc.type ) {
|
|---|
| 1430 | os << "... type: ";
|
|---|
| 1431 | assoc.type->accept( *this );
|
|---|
| [94b1f718] | 1432 | os << endl << indent << "... expression: ";
|
|---|
| [a16e246] | 1433 | safe_print( assoc.expr );
|
|---|
| 1434 | } else {
|
|---|
| 1435 | os << "... default: ";
|
|---|
| 1436 | safe_print( assoc.expr );
|
|---|
| 1437 | }
|
|---|
| [94b1f718] | 1438 | os << endl;
|
|---|
| [a16e246] | 1439 | }
|
|---|
| 1440 | --indent;
|
|---|
| 1441 |
|
|---|
| [461046f] | 1442 | return node;
|
|---|
| 1443 | }
|
|---|
| 1444 |
|
|---|
| [e67991f] | 1445 | virtual const ast::Type * visit( const ast::VoidType * node ) override final {
|
|---|
| [b0ec971] | 1446 | preprint( node );
|
|---|
| 1447 | os << "void";
|
|---|
| [461046f] | 1448 | return node;
|
|---|
| 1449 | }
|
|---|
| 1450 |
|
|---|
| [e67991f] | 1451 | virtual const ast::Type * visit( const ast::BasicType * node ) override final {
|
|---|
| [b0ec971] | 1452 | preprint( node );
|
|---|
| 1453 | os << ast::BasicType::typeNames[ node->kind ];
|
|---|
| [461046f] | 1454 | return node;
|
|---|
| 1455 | }
|
|---|
| 1456 |
|
|---|
| [e67991f] | 1457 | virtual const ast::Type * visit( const ast::PointerType * node ) override final {
|
|---|
| [b0ec971] | 1458 | preprint( node );
|
|---|
| 1459 | if ( ! node->isArray() ) {
|
|---|
| 1460 | os << "pointer to ";
|
|---|
| 1461 | } else {
|
|---|
| 1462 | os << "decayed ";
|
|---|
| 1463 | if ( node->isStatic ) {
|
|---|
| 1464 | os << "static ";
|
|---|
| 1465 | }
|
|---|
| 1466 |
|
|---|
| 1467 | if ( node->isVarLen ) {
|
|---|
| 1468 | os << "variable length array of ";
|
|---|
| 1469 | } else if ( node->dimension ) {
|
|---|
| 1470 | os << "array of ";
|
|---|
| 1471 | node->dimension->accept( *this );
|
|---|
| 1472 | os << " ";
|
|---|
| 1473 | }
|
|---|
| 1474 | }
|
|---|
| [20a5977] | 1475 | safe_print( node->base );
|
|---|
| [b0ec971] | 1476 |
|
|---|
| [461046f] | 1477 | return node;
|
|---|
| 1478 | }
|
|---|
| 1479 |
|
|---|
| [e67991f] | 1480 | virtual const ast::Type * visit( const ast::ArrayType * node ) override final {
|
|---|
| [b0ec971] | 1481 | preprint( node );
|
|---|
| 1482 | if ( node->isStatic ) {
|
|---|
| 1483 | os << "static ";
|
|---|
| 1484 | }
|
|---|
| 1485 |
|
|---|
| 1486 | if ( node->isVarLen ) {
|
|---|
| 1487 | os << "variable length array of ";
|
|---|
| 1488 | } else if ( node->dimension ) {
|
|---|
| 1489 | os << "array of ";
|
|---|
| 1490 | } else {
|
|---|
| 1491 | os << "open array of ";
|
|---|
| 1492 | }
|
|---|
| 1493 |
|
|---|
| [20a5977] | 1494 | safe_print( node->base );
|
|---|
| [b0ec971] | 1495 |
|
|---|
| 1496 | if ( node->dimension ) {
|
|---|
| 1497 | os << " with dimension of ";
|
|---|
| 1498 | node->dimension->accept( *this );
|
|---|
| 1499 | }
|
|---|
| 1500 |
|
|---|
| [461046f] | 1501 | return node;
|
|---|
| 1502 | }
|
|---|
| 1503 |
|
|---|
| [e67991f] | 1504 | virtual const ast::Type * visit( const ast::ReferenceType * node ) override final {
|
|---|
| [b0ec971] | 1505 | preprint( node );
|
|---|
| 1506 | os << "reference to ";
|
|---|
| [20a5977] | 1507 | safe_print( node->base );
|
|---|
| [b0ec971] | 1508 |
|
|---|
| [461046f] | 1509 | return node;
|
|---|
| 1510 | }
|
|---|
| 1511 |
|
|---|
| [e67991f] | 1512 | virtual const ast::Type * visit( const ast::QualifiedType * node ) override final {
|
|---|
| [b0ec971] | 1513 | preprint( node );
|
|---|
| 1514 | ++indent;
|
|---|
| [94b1f718] | 1515 | os << "Qualified Type:" << endl << indent;
|
|---|
| [20a5977] | 1516 | safe_print( node->parent );
|
|---|
| [94b1f718] | 1517 | os << endl << indent;
|
|---|
| [20a5977] | 1518 | safe_print( node->child );
|
|---|
| [94b1f718] | 1519 | os << endl;
|
|---|
| [b0ec971] | 1520 | --indent;
|
|---|
| 1521 |
|
|---|
| [461046f] | 1522 | return node;
|
|---|
| 1523 | }
|
|---|
| 1524 |
|
|---|
| [e67991f] | 1525 | virtual const ast::Type * visit( const ast::FunctionType * node ) override final {
|
|---|
| [b0ec971] | 1526 | preprint( node );
|
|---|
| [d908563] | 1527 |
|
|---|
| [94b1f718] | 1528 | os << "function" << endl;
|
|---|
| [b0ec971] | 1529 | if ( ! node->params.empty() ) {
|
|---|
| [94b1f718] | 1530 | os << indent << "... with parameters" << endl;
|
|---|
| [b0ec971] | 1531 | ++indent;
|
|---|
| 1532 | printAll( node->params );
|
|---|
| 1533 | if ( node->isVarArgs ) {
|
|---|
| [94b1f718] | 1534 | os << indent << "and a variable number of other arguments" << endl;
|
|---|
| [b0ec971] | 1535 | }
|
|---|
| 1536 | --indent;
|
|---|
| 1537 | } else if ( node->isVarArgs ) {
|
|---|
| [94b1f718] | 1538 | os << indent+1 << "accepting unspecified arguments" << endl;
|
|---|
| [b0ec971] | 1539 | }
|
|---|
| 1540 |
|
|---|
| 1541 | os << indent << "... returning";
|
|---|
| 1542 | if ( node->returns.empty() ) {
|
|---|
| [94b1f718] | 1543 | os << " nothing" << endl;
|
|---|
| [b0ec971] | 1544 | } else {
|
|---|
| [94b1f718] | 1545 | os << endl;
|
|---|
| [b0ec971] | 1546 | ++indent;
|
|---|
| 1547 | printAll( node->returns );
|
|---|
| 1548 | --indent;
|
|---|
| 1549 | }
|
|---|
| 1550 |
|
|---|
| [461046f] | 1551 | return node;
|
|---|
| 1552 | }
|
|---|
| 1553 |
|
|---|
| [e67991f] | 1554 | virtual const ast::Type * visit( const ast::StructInstType * node ) override final {
|
|---|
| [b0ec971] | 1555 | preprint( node );
|
|---|
| 1556 | os << "instance of struct " << node->name;
|
|---|
| 1557 | if ( node->base ) {
|
|---|
| 1558 | os << " " << ( node->base->body ? "with" : "without" ) << " body";
|
|---|
| 1559 | }
|
|---|
| 1560 | print( node->params );
|
|---|
| 1561 |
|
|---|
| [461046f] | 1562 | return node;
|
|---|
| 1563 | }
|
|---|
| 1564 |
|
|---|
| [e67991f] | 1565 | virtual const ast::Type * visit( const ast::UnionInstType * node ) override final {
|
|---|
| [b0ec971] | 1566 | preprint( node );
|
|---|
| 1567 | os << "instance of union " << node->name;
|
|---|
| 1568 | if ( node->base ) {
|
|---|
| 1569 | os << " " << ( node->base->body ? "with" : "without" ) << " body";
|
|---|
| 1570 | }
|
|---|
| 1571 | print( node->params );
|
|---|
| 1572 |
|
|---|
| [461046f] | 1573 | return node;
|
|---|
| 1574 | }
|
|---|
| 1575 |
|
|---|
| [e67991f] | 1576 | virtual const ast::Type * visit( const ast::EnumInstType * node ) override final {
|
|---|
| [b0ec971] | 1577 | preprint( node );
|
|---|
| 1578 | os << "instance of enum " << node->name;
|
|---|
| 1579 | if ( node->base ) {
|
|---|
| 1580 | os << " " << ( node->base->body ? "with" : "without" ) << " body";
|
|---|
| 1581 | }
|
|---|
| 1582 | print( node->params );
|
|---|
| 1583 |
|
|---|
| [461046f] | 1584 | return node;
|
|---|
| 1585 | }
|
|---|
| 1586 |
|
|---|
| [e67991f] | 1587 | virtual const ast::Type * visit( const ast::TraitInstType * node ) override final {
|
|---|
| [b0ec971] | 1588 | preprint( node );
|
|---|
| 1589 | os << "instance of trait " << node->name;
|
|---|
| 1590 | print( node->params );
|
|---|
| 1591 |
|
|---|
| [461046f] | 1592 | return node;
|
|---|
| 1593 | }
|
|---|
| 1594 |
|
|---|
| [e67991f] | 1595 | virtual const ast::Type * visit( const ast::TypeInstType * node ) override final {
|
|---|
| [b0ec971] | 1596 | preprint( node );
|
|---|
| [3e5dd913] | 1597 | const auto & _name = deterministic_output && isUnboundType(node) ? "[unbound]" : node->typeString();
|
|---|
| [cd6a6ff] | 1598 | os << "instance of type " << _name
|
|---|
| [07de76b] | 1599 | << " (" << (node->kind == ast::TypeDecl::Ftype ? "" : "not ") << "function type)";
|
|---|
| [b0ec971] | 1600 | print( node->params );
|
|---|
| 1601 |
|
|---|
| [461046f] | 1602 | return node;
|
|---|
| 1603 | }
|
|---|
| 1604 |
|
|---|
| [e67991f] | 1605 | virtual const ast::Type * visit( const ast::TupleType * node ) override final {
|
|---|
| [b0ec971] | 1606 | preprint( node );
|
|---|
| [94b1f718] | 1607 | os << "tuple of types" << endl;
|
|---|
| [b0ec971] | 1608 | ++indent;
|
|---|
| 1609 | printAll( node->types );
|
|---|
| 1610 | --indent;
|
|---|
| 1611 |
|
|---|
| [461046f] | 1612 | return node;
|
|---|
| 1613 | }
|
|---|
| 1614 |
|
|---|
| [e67991f] | 1615 | virtual const ast::Type * visit( const ast::TypeofType * node ) override final {
|
|---|
| [b0ec971] | 1616 | preprint( node );
|
|---|
| 1617 | if ( node->kind == ast::TypeofType::Basetypeof ) { os << "base-"; }
|
|---|
| 1618 | os << "type-of expression ";
|
|---|
| [20a5977] | 1619 | safe_print( node->expr );
|
|---|
| [b0ec971] | 1620 |
|
|---|
| [461046f] | 1621 | return node;
|
|---|
| 1622 | }
|
|---|
| 1623 |
|
|---|
| [3945abe] | 1624 | virtual const ast::Type * visit( const ast::VTableType * node ) override final {
|
|---|
| 1625 | preprint( node );
|
|---|
| 1626 | os << "vtable for ";
|
|---|
| 1627 | safe_print( node->base );
|
|---|
| 1628 |
|
|---|
| 1629 | return node;
|
|---|
| 1630 | }
|
|---|
| 1631 |
|
|---|
| [e67991f] | 1632 | virtual const ast::Type * visit( const ast::VarArgsType * node ) override final {
|
|---|
| [b0ec971] | 1633 | preprint( node );
|
|---|
| 1634 | os << "builtin var args pack";
|
|---|
| [461046f] | 1635 | return node;
|
|---|
| 1636 | }
|
|---|
| 1637 |
|
|---|
| [e67991f] | 1638 | virtual const ast::Type * visit( const ast::ZeroType * node ) override final {
|
|---|
| [b0ec971] | 1639 | preprint( node );
|
|---|
| 1640 | os << "zero_t";
|
|---|
| [461046f] | 1641 | return node;
|
|---|
| 1642 | }
|
|---|
| 1643 |
|
|---|
| [e67991f] | 1644 | virtual const ast::Type * visit( const ast::OneType * node ) override final {
|
|---|
| [b0ec971] | 1645 | preprint( node );
|
|---|
| 1646 | os << "one_t";
|
|---|
| [461046f] | 1647 | return node;
|
|---|
| 1648 | }
|
|---|
| 1649 |
|
|---|
| [e67991f] | 1650 | virtual const ast::Type * visit( const ast::GlobalScopeType * node ) override final {
|
|---|
| [b0ec971] | 1651 | preprint( node );
|
|---|
| 1652 | os << "Global Scope Type";
|
|---|
| [461046f] | 1653 | return node;
|
|---|
| 1654 | }
|
|---|
| 1655 |
|
|---|
| [e67991f] | 1656 | virtual const ast::Designation * visit( const ast::Designation * node ) override final {
|
|---|
| [c957e7f] | 1657 | if ( node->designators.empty() ) return node;
|
|---|
| [94b1f718] | 1658 | os << "... designated by: " << endl;
|
|---|
| [c957e7f] | 1659 | ++indent;
|
|---|
| 1660 | for ( const ast::Expr * d : node->designators ) {
|
|---|
| 1661 | os << indent;
|
|---|
| 1662 | d->accept( *this );
|
|---|
| [94b1f718] | 1663 | os << endl;
|
|---|
| [c957e7f] | 1664 | }
|
|---|
| 1665 | --indent;
|
|---|
| [461046f] | 1666 | return node;
|
|---|
| 1667 | }
|
|---|
| 1668 |
|
|---|
| [e67991f] | 1669 | virtual const ast::Init * visit( const ast::SingleInit * node ) override final {
|
|---|
| [c957e7f] | 1670 | os << "Simple Initializer: ";
|
|---|
| [20a5977] | 1671 | safe_print( node->value );
|
|---|
| [461046f] | 1672 | return node;
|
|---|
| 1673 | }
|
|---|
| 1674 |
|
|---|
| [e67991f] | 1675 | virtual const ast::Init * visit( const ast::ListInit * node ) override final {
|
|---|
| [94b1f718] | 1676 | os << "Compound initializer: " << endl;
|
|---|
| [c957e7f] | 1677 | ++indent;
|
|---|
| 1678 | for ( auto p : group_iterate( node->designations, node->initializers ) ) {
|
|---|
| 1679 | const ast::Designation * d = std::get<0>(p);
|
|---|
| 1680 | const ast::Init * init = std::get<1>(p);
|
|---|
| 1681 | os << indent;
|
|---|
| 1682 | init->accept( *this );
|
|---|
| [94b1f718] | 1683 | os << endl;
|
|---|
| [c957e7f] | 1684 | if ( ! d->designators.empty() ) {
|
|---|
| 1685 | os << indent;
|
|---|
| 1686 | d->accept( *this );
|
|---|
| 1687 | }
|
|---|
| 1688 | }
|
|---|
| 1689 | --indent;
|
|---|
| [461046f] | 1690 | return node;
|
|---|
| 1691 | }
|
|---|
| 1692 |
|
|---|
| [e67991f] | 1693 | virtual const ast::Init * visit( const ast::ConstructorInit * node ) override final {
|
|---|
| [94b1f718] | 1694 | os << "Constructor initializer: " << endl;
|
|---|
| [c957e7f] | 1695 | if ( node->ctor ) {
|
|---|
| 1696 | os << indent << "... initially constructed with ";
|
|---|
| 1697 | ++indent;
|
|---|
| 1698 | node->ctor->accept( *this );
|
|---|
| 1699 | --indent;
|
|---|
| 1700 | }
|
|---|
| 1701 |
|
|---|
| 1702 | if ( node->dtor ) {
|
|---|
| 1703 | os << indent << "... destructed with ";
|
|---|
| 1704 | ++indent;
|
|---|
| 1705 | node->dtor->accept( *this );
|
|---|
| 1706 | --indent;
|
|---|
| 1707 | }
|
|---|
| 1708 |
|
|---|
| 1709 | if ( node->init ) {
|
|---|
| 1710 | os << indent << "... with fallback C-style initializer: ";
|
|---|
| 1711 | ++indent;
|
|---|
| 1712 | node->init->accept( *this );
|
|---|
| 1713 | --indent;
|
|---|
| 1714 | }
|
|---|
| [461046f] | 1715 | return node;
|
|---|
| 1716 | }
|
|---|
| 1717 |
|
|---|
| [e67991f] | 1718 | virtual const ast::Attribute * visit( const ast::Attribute * node ) override final {
|
|---|
| [489bacf] | 1719 | if ( node->empty() ) return node;
|
|---|
| 1720 | os << "Attribute with name: " << node->name;
|
|---|
| 1721 | if ( node->params.empty() ) return node;
|
|---|
| [94b1f718] | 1722 | os << " with parameters: " << endl;
|
|---|
| [489bacf] | 1723 | ++indent;
|
|---|
| 1724 | printAll( node->params );
|
|---|
| 1725 | --indent;
|
|---|
| [461046f] | 1726 | return node;
|
|---|
| 1727 | }
|
|---|
| 1728 |
|
|---|
| [e67991f] | 1729 | virtual const ast::TypeSubstitution * visit( const ast::TypeSubstitution * node ) override final {
|
|---|
| [94b1f718] | 1730 | os << indent << "Types:" << endl;
|
|---|
| [76ed81f] | 1731 | for ( const auto& i : *node ) {
|
|---|
| [3e5dd913] | 1732 | os << indent+1 << i.first.typeString() << " -> ";
|
|---|
| [76ed81f] | 1733 | indent += 2;
|
|---|
| [20a5977] | 1734 | safe_print( i.second );
|
|---|
| [76ed81f] | 1735 | indent -= 2;
|
|---|
| [94b1f718] | 1736 | os << endl;
|
|---|
| [76ed81f] | 1737 | }
|
|---|
| [461046f] | 1738 | return node;
|
|---|
| 1739 | }
|
|---|
| 1740 |
|
|---|
| 1741 | };
|
|---|
| 1742 |
|
|---|
| [257a8f5] | 1743 | } // namespace
|
|---|
| 1744 |
|
|---|
| [5902625] | 1745 | void print( ostream & os, const ast::Node * node, Indenter indent ) {
|
|---|
| 1746 | Printer printer { os, indent, false };
|
|---|
| 1747 | node->accept(printer);
|
|---|
| 1748 | }
|
|---|
| 1749 |
|
|---|
| [6f4b7f2] | 1750 | void printShort( ostream & os, const ast::Decl * node, Indenter indent ) {
|
|---|
| [5902625] | 1751 | Printer printer { os, indent, true };
|
|---|
| [461046f] | 1752 | node->accept(printer);
|
|---|
| 1753 | }
|
|---|
| 1754 |
|
|---|
| [257a8f5] | 1755 | void print( ostream & os, Function::Specs specs ) {
|
|---|
| 1756 | print( os, specs, Names::FuncSpecifiers );
|
|---|
| 1757 | }
|
|---|
| 1758 |
|
|---|
| 1759 | void print( ostream & os, Storage::Classes storage ) {
|
|---|
| 1760 | print( os, storage, Names::StorageClasses );
|
|---|
| [461046f] | 1761 | }
|
|---|
| [257a8f5] | 1762 |
|
|---|
| 1763 | void print( ostream & os, CV::Qualifiers qualifiers ) {
|
|---|
| 1764 | print( os, qualifiers, Names::Qualifiers );
|
|---|
| 1765 | }
|
|---|
| 1766 |
|
|---|
| 1767 | } // namespace ast
|
|---|