Changes in / [0b57626:a2e758e]
- Location:
- src
- Files:
-
- 5 edited
-
AST/GenericSubstitution.cpp (modified) (1 diff)
-
AST/Pass.proto.hpp (modified) (2 diffs)
-
AST/Print.cpp (modified) (16 diffs)
-
AST/module.mk (modified) (1 diff)
-
Makefile.in (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/GenericSubstitution.cpp
r0b57626 ra2e758e 23 23 #include "Pass.hpp" 24 24 #include "Type.hpp" 25 #include "TypeSubstitution. cpp"25 #include "TypeSubstitution.hpp" 26 26 27 27 namespace ast { -
src/AST/Pass.proto.hpp
r0b57626 ra2e758e 115 115 static constexpr bool value = std::is_void< ret_t >::value || 116 116 std::is_base_of<const node_t, typename std::remove_pointer<ret_t>::type >::value; 117 }; 118 119 template<bool is_void> 120 struct __assign; 121 122 template<> 123 struct __assign<true> { 124 template<typename pass_t, typename node_t> 125 static inline void result( pass_t & pass, const node_t * & node ) { 126 pass.previsit( node ); 127 } 128 }; 129 130 template<> 131 struct __assign<false> { 132 template<typename pass_t, typename node_t> 133 static inline void result( pass_t & pass, const node_t * & node ) { 134 node = pass.previsit( node ); 135 assertf(node, "Previsit must not return NULL"); 136 } 117 137 }; 118 138 … … 138 158 "Previsit may not change the type of the node. It must return its paremeter or void." 139 159 ); 140 if(std::is_void< decltype( pass.previsit(node) ) >::value) { 141 pass.previsit( node );142 } else {143 node = pass.previsit( node );144 assert(node);145 }160 161 __assign< 162 std::is_void< 163 decltype( pass.previsit( node ) ) 164 >::value 165 >::result( pass, node ); 146 166 } 147 167 -
src/AST/Print.cpp
r0b57626 ra2e758e 7 7 // Print.cpp -- 8 8 // 9 // Author : Thierry Delisle10 // Created On : Tue May 21 16:20:15 20199 // Author : Thierry Delisle 10 // Created On : Tue May 21 16:20:15 2019 11 11 // Last Modified By : 12 12 // Last Modified On : 13 // Update Count :13 // Update Count : 14 14 // 15 15 … … 22 22 #include "TypeSubstitution.hpp" 23 23 24 #include "Common/utility.h" // for group_iterate 24 #include "Common/utility.h" // for group_iterate 25 26 using namespace std; 25 27 26 28 namespace ast { … … 28 30 template <typename C, typename... T> 29 31 constexpr auto make_array(T&&... values) -> 30 std::array<C,sizeof...(T)>32 array<C,sizeof...(T)> 31 33 { 32 return std::array<C,sizeof...(T)>{33 std::forward<T>(values)...34 return array<C,sizeof...(T)>{ 35 forward<T>(values)... 34 36 }; 35 37 } … … 37 39 class Printer : public Visitor { 38 40 public: 39 std::ostream & os;41 ostream & os; 40 42 Indenter indent; 41 42 Printer(std::ostream & os, Indenter indent) : os( os ), indent( indent ) {} 43 bool short_mode; 44 45 Printer(ostream & os, Indenter indent, bool short_mode) : os( os ), indent( indent ), short_mode(short_mode) {} 43 46 44 47 private: … … 51 54 // need an endl after each element because it's not 52 55 // easy to know when each individual item should end 53 os << std::endl;56 os << endl; 54 57 } // if 55 58 } // for … … 74 77 75 78 template<typename storage_t, size_t N> 76 void print(const storage_t & storage, const std::array<const char *, N> & Names ) {79 void print(const storage_t & storage, const array<const char *, N> & Names ) { 77 80 if ( storage.any() ) { 78 81 for ( size_t i = 0; i < Names.size(); i += 1 ) { … … 96 99 } 97 100 101 void print( const ast::AggregateDecl * node ) { 102 os << node->typeString() << " " << node->name << ":"; 103 if ( node->linkage != Linkage::Cforall ) { 104 os << " " << Linkage::name( node->linkage ); 105 } // if 106 os << " with body : " << (node->body ? "yes " : "no "); 107 108 if ( ! node->params.empty() ) { 109 os << endl << indent << "... with parameters" << endl; 110 ++indent; 111 printAll( node->params ); 112 --indent; 113 } // if 114 if ( ! node->members.empty() ) { 115 os << endl << indent << "... with members" << endl; 116 ++indent; 117 printAll( node->members ); 118 --indent; 119 } // if 120 if ( ! node->attributes.empty() ) { 121 os << endl << indent << "... with attributes" << endl; 122 ++indent; 123 printAll( node->attributes ); 124 --indent; 125 } // if 126 os << endl; 127 } 128 129 void print( const ast::NamedTypeDecl * node ) { 130 if ( !node->name.empty() ) os << node->name << ": "; 131 132 if ( node->linkage != Linkage::Cforall ) { 133 os << Linkage::name( node->linkage ) << " "; 134 } // if 135 print( node->storage ); 136 os << node->typeString(); 137 if ( node->base ) { 138 os << " for "; 139 ++indent; 140 node->base->accept( *this ); 141 --indent; 142 } // if 143 if ( ! node->params.empty() ) { 144 os << endl << indent << "... with parameters" << endl; 145 ++indent; 146 printAll( node->params ); 147 --indent; 148 } // if 149 if ( ! node->assertions.empty() ) { 150 os << endl << indent << "... with assertions" << endl; 151 ++indent; 152 printAll( node->assertions ); 153 --indent; 154 } // if 155 } 156 98 157 public: 99 virtual const ast::DeclWithType * visit( const ast::ObjectDecl* node ) {100 if ( node->name != "") os << node->name << ": ";158 virtual const ast::DeclWithType * visit( const ast::ObjectDecl * node ) { 159 if ( !node->name.empty() ) os << node->name << ": "; 101 160 102 161 if ( node->linkage != Linkage::Cforall ) { … … 117 176 ? "maybe constructed" 118 177 : "not constructed" 119 ) << ")" << std::endl << indent+1;178 ) << ")" << endl << indent+1; 120 179 121 180 ++indent; 122 181 node->init->accept( *this ); 123 182 --indent; 124 os << std::endl;183 os << endl; 125 184 } // if 126 185 127 186 if ( ! node->attributes.empty() ) { 128 os << std::endl << indent << "... with attributes:" << std::endl;187 os << endl << indent << "... with attributes:" << endl; 129 188 ++indent; 130 189 printAll( node->attributes ); … … 139 198 } 140 199 141 virtual const ast::DeclWithType * visit( const ast::FunctionDecl * node ) { 142 return node; 143 } 144 145 virtual const ast::Decl * visit( const ast::StructDecl * node ) { 146 return node; 147 } 148 149 virtual const ast::Decl * visit( const ast::UnionDecl * node ) { 150 return node; 151 } 152 153 virtual const ast::Decl * visit( const ast::EnumDecl * node ) { 154 return node; 155 } 156 157 virtual const ast::Decl * visit( const ast::TraitDecl * node ) { 158 return node; 159 } 160 161 virtual const ast::Decl * visit( const ast::TypeDecl * node ) { 162 return node; 163 } 164 165 virtual const ast::Decl * visit( const ast::TypedefDecl * node ) { 166 return node; 167 } 168 169 virtual const ast::AsmDecl * visit( const ast::AsmDecl * node ) { 170 return node; 171 } 172 173 virtual const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl * node ) { 174 return node; 175 } 176 177 virtual const ast::CompoundStmt * visit( const ast::CompoundStmt * node ) { 178 return node; 179 } 180 181 virtual const ast::Stmt * visit( const ast::ExprStmt * node ) { 182 return node; 183 } 184 185 virtual const ast::Stmt * visit( const ast::AsmStmt * node ) { 186 return node; 187 } 188 189 virtual const ast::Stmt * visit( const ast::DirectiveStmt * node ) { 190 return node; 191 } 192 193 virtual const ast::Stmt * visit( const ast::IfStmt * node ) { 194 return node; 195 } 196 197 virtual const ast::Stmt * visit( const ast::WhileStmt * node ) { 198 return node; 199 } 200 201 virtual const ast::Stmt * visit( const ast::ForStmt * node ) { 202 return node; 203 } 204 205 virtual const ast::Stmt * visit( const ast::SwitchStmt * node ) { 206 return node; 207 } 208 209 virtual const ast::Stmt * visit( const ast::CaseStmt * node ) { 210 return node; 211 } 212 213 virtual const ast::Stmt * visit( const ast::BranchStmt * node ) { 214 return node; 215 } 216 217 virtual const ast::Stmt * visit( const ast::ReturnStmt * node ) { 218 return node; 219 } 220 221 virtual const ast::Stmt * visit( const ast::ThrowStmt * node ) { 222 return node; 223 } 224 225 virtual const ast::Stmt * visit( const ast::TryStmt * node ) { 226 return node; 227 } 228 229 virtual const ast::Stmt * visit( const ast::CatchStmt * node ) { 230 return node; 231 } 232 233 virtual const ast::Stmt * visit( const ast::FinallyStmt * node ) { 234 return node; 235 } 236 237 virtual const ast::Stmt * visit( const ast::WaitForStmt * node ) { 238 return node; 239 } 240 241 virtual const ast::Stmt * visit( const ast::WithStmt * node ) { 242 return node; 243 } 244 245 virtual const ast::NullStmt * visit( const ast::NullStmt * node ) { 246 return node; 247 } 248 249 virtual const ast::Stmt * visit( const ast::DeclStmt * node ) { 250 return node; 251 } 252 253 virtual const ast::Stmt * visit( const ast::ImplicitCtorDtorStmt * node ) { 254 return node; 255 } 256 257 virtual const ast::Expr * visit( const ast::ApplicationExpr * node ) { 258 return node; 259 } 260 261 virtual const ast::Expr * visit( const ast::UntypedExpr * node ) { 262 return node; 263 } 264 265 virtual const ast::Expr * visit( const ast::NameExpr * node ) { 266 return node; 267 } 268 269 virtual const ast::Expr * visit( const ast::AddressExpr * node ) { 270 return node; 271 } 272 273 virtual const ast::Expr * visit( const ast::LabelAddressExpr * node ) { 274 return node; 275 } 276 277 virtual const ast::Expr * visit( const ast::CastExpr * node ) { 278 return node; 279 } 280 281 virtual const ast::Expr * visit( const ast::KeywordCastExpr * node ) { 282 return node; 283 } 284 285 virtual const ast::Expr * visit( const ast::VirtualCastExpr * node ) { 286 return node; 287 } 288 289 virtual const ast::Expr * visit( const ast::UntypedMemberExpr * node ) { 290 return node; 291 } 292 293 virtual const ast::Expr * visit( const ast::MemberExpr * node ) { 294 return node; 295 } 296 297 virtual const ast::Expr * visit( const ast::VariableExpr * node ) { 298 return node; 299 } 300 301 virtual const ast::Expr * visit( const ast::ConstantExpr * node ) { 302 return node; 303 } 304 305 virtual const ast::Expr * visit( const ast::SizeofExpr * node ) { 306 return node; 307 } 308 309 virtual const ast::Expr * visit( const ast::AlignofExpr * node ) { 310 return node; 311 } 312 313 virtual const ast::Expr * visit( const ast::UntypedOffsetofExpr * node ) { 314 return node; 315 } 316 317 virtual const ast::Expr * visit( const ast::OffsetofExpr * node ) { 318 return node; 319 } 320 321 virtual const ast::Expr * visit( const ast::OffsetPackExpr * node ) { 322 return node; 323 } 324 325 virtual const ast::Expr * visit( const ast::LogicalExpr * node ) { 326 return node; 327 } 328 329 virtual const ast::Expr * visit( const ast::ConditionalExpr * node ) { 330 return node; 331 } 332 333 virtual const ast::Expr * visit( const ast::CommaExpr * node ) { 334 return node; 335 } 336 337 virtual const ast::Expr * visit( const ast::TypeExpr * node ) { 338 return node; 339 } 340 341 virtual const ast::Expr * visit( const ast::AsmExpr * node ) { 342 return node; 343 } 344 345 virtual const ast::Expr * visit( const ast::ImplicitCopyCtorExpr * node ) { 346 return node; 347 } 348 349 virtual const ast::Expr * visit( const ast::ConstructorExpr * node ) { 350 return node; 351 } 352 353 virtual const ast::Expr * visit( const ast::CompoundLiteralExpr * node ) { 354 return node; 355 } 356 357 virtual const ast::Expr * visit( const ast::RangeExpr * node ) { 358 return node; 359 } 360 361 virtual const ast::Expr * visit( const ast::UntypedTupleExpr * node ) { 362 return node; 363 } 364 365 virtual const ast::Expr * visit( const ast::TupleExpr * node ) { 366 return node; 367 } 368 369 virtual const ast::Expr * visit( const ast::TupleIndexExpr * node ) { 370 return node; 371 } 372 373 virtual const ast::Expr * visit( const ast::TupleAssignExpr * node ) { 374 return node; 375 } 376 377 virtual const ast::Expr * visit( const ast::StmtExpr * node ) { 378 return node; 379 } 380 381 virtual const ast::Expr * visit( const ast::UniqueExpr * node ) { 382 return node; 383 } 384 385 virtual const ast::Expr * visit( const ast::UntypedInitExpr * node ) { 386 return node; 387 } 388 389 virtual const ast::Expr * visit( const ast::InitExpr * node ) { 390 return node; 391 } 392 393 virtual const ast::Expr * visit( const ast::DeletedExpr * node ) { 394 return node; 395 } 396 397 virtual const ast::Expr * visit( const ast::DefaultArgExpr * node ) { 398 return node; 399 } 400 401 virtual const ast::Expr * visit( const ast::GenericExpr * node ) { 402 return node; 403 } 404 405 virtual const ast::Type * visit( const ast::VoidType * node ) { 406 return node; 407 } 408 409 virtual const ast::Type * visit( const ast::BasicType * node ) { 410 return node; 411 } 412 413 virtual const ast::Type * visit( const ast::PointerType * node ) { 414 return node; 415 } 416 417 virtual const ast::Type * visit( const ast::ArrayType * node ) { 418 return node; 419 } 420 421 virtual const ast::Type * visit( const ast::ReferenceType * node ) { 422 return node; 423 } 424 425 virtual const ast::Type * visit( const ast::QualifiedType * node ) { 426 return node; 427 } 428 429 virtual const ast::Type * visit( const ast::FunctionType * node ) { 430 return node; 431 } 432 433 virtual const ast::Type * visit( const ast::StructInstType * node ) { 434 return node; 435 } 436 437 virtual const ast::Type * visit( const ast::UnionInstType * node ) { 438 return node; 439 } 440 441 virtual const ast::Type * visit( const ast::EnumInstType * node ) { 442 return node; 443 } 444 445 virtual const ast::Type * visit( const ast::TraitInstType * node ) { 446 return node; 447 } 448 449 virtual const ast::Type * visit( const ast::TypeInstType * node ) { 450 return node; 451 } 452 453 virtual const ast::Type * visit( const ast::TupleType * node ) { 454 return node; 455 } 456 457 virtual const ast::Type * visit( const ast::TypeofType * node ) { 458 return node; 459 } 460 461 virtual const ast::Type * visit( const ast::VarArgsType * node ) { 462 return node; 463 } 464 465 virtual const ast::Type * visit( const ast::ZeroType * node ) { 466 return node; 467 } 468 469 virtual const ast::Type * visit( const ast::OneType * node ) { 470 return node; 471 } 472 473 virtual const ast::Type * visit( const ast::GlobalScopeType * node ) { 474 return node; 475 } 476 477 virtual const ast::Designation * visit( const ast::Designation * node ) { 200 virtual const ast::DeclWithType * visit( const ast::FunctionDecl * node ) { 201 if ( !node->name.empty() ) { 202 os << node->name << ": "; 203 } // if 204 if ( node->linkage != Linkage::Cforall ) { 205 os << Linkage::name( node->linkage ) << " "; 206 } // if 207 208 printAll( node->attributes ); 209 210 print( node->storage ); 211 print( node->funcSpec ); 212 213 if ( node->type ) { 214 node->type->accept( *this ); 215 } else { 216 os << "untyped entity "; 217 } // if 218 219 if ( node->stmts ) { 220 os << indent << "... with body" << endl << indent+1; 221 ++indent; 222 node->stmts->accept( *this ); 223 --indent; 224 } // if 225 return node; 226 } 227 228 virtual const ast::Decl * visit( const ast::StructDecl * node ) { 229 print(node); 230 return node; 231 } 232 233 virtual const ast::Decl * visit( const ast::UnionDecl * node ) { 234 print(node); 235 return node; 236 } 237 238 virtual const ast::Decl * visit( const ast::EnumDecl * node ) { 239 print(node); 240 return node; 241 } 242 243 virtual const ast::Decl * visit( const ast::TraitDecl * node ) { 244 print(node); 245 return node; 246 } 247 248 virtual const ast::Decl * visit( const ast::TypeDecl * node ) { 249 print( node ); 250 if ( node->init ) { 251 os << endl << indent << "with type initializer: "; 252 ++indent; 253 node->init->accept( *this ); 254 --indent; 255 } 256 return node; 257 } 258 259 virtual const ast::Decl * visit( const ast::TypedefDecl * node ) { 260 print( node ); 261 return node; 262 } 263 264 virtual const ast::AsmDecl * visit( const ast::AsmDecl * node ) { 265 node->stmt->accept( *this ); 266 return node; 267 } 268 269 virtual const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl * node ) { 270 os << "Static Assert with condition: "; 271 ++indent; 272 node->cond->accept( *this ); 273 --indent; 274 os << endl << indent << "and message: "; 275 ++indent; 276 node->msg->accept( *this ); 277 --indent; 278 os << endl; 279 return node; 280 } 281 282 virtual const ast::CompoundStmt * visit( const ast::CompoundStmt * node ) { 283 os << "CompoundStmt" << endl; 284 ++indent; 285 printAll( node->kids ); 286 --indent; 287 return node; 288 } 289 290 virtual const ast::Stmt * visit( const ast::ExprStmt * node ) { 291 ++indent; 292 os << "Expression Statement:" << endl << indent; 293 node->expr->accept( *this ); 294 --indent; 295 return node; 296 } 297 298 virtual const ast::Stmt * visit( const ast::AsmStmt * node ) { 299 os << "Assembler Statement:" << endl; 300 ++indent; 301 os << indent << "instruction: " << endl << indent; 302 node->instruction->accept( *this ); 303 if ( ! node->output.empty() ) { 304 os << endl << indent+1 << "output: " << endl; 305 printAll( node->output ); 306 } // if 307 if ( ! node->input.empty() ) { 308 os << indent+1 << "input: " << endl; 309 printAll( node->input ); 310 } // if 311 if ( ! node->clobber.empty() ) { 312 os << indent+1 << "clobber: " << endl; 313 printAll( node->clobber ); 314 } // if 315 --indent; 316 return node; 317 } 318 319 virtual const ast::Stmt * visit( const ast::DirectiveStmt * node ) { 320 os << "GCC Directive:" << node->directive << endl; 321 return node; 322 } 323 324 virtual const ast::Stmt * visit( const ast::IfStmt * node ) { 325 os << "If on condition: " << endl; 326 os << indent+1; 327 ++indent; 328 node->cond->accept( *this ); 329 --indent; 330 331 if ( !node->inits.empty() ) { 332 os << indent << "... with initialization: \n"; 333 ++indent; 334 for ( const Stmt * stmt : node->inits ) { 335 os << indent; 336 stmt->accept( *this ); 337 } 338 --indent; 339 os << endl; 340 } 341 342 os << indent << "... then: " << endl; 343 344 ++indent; 345 os << indent; 346 node->thenPart->accept( *this ); 347 --indent; 348 349 if ( node->elsePart != 0 ) { 350 os << indent << "... else: " << endl; 351 ++indent; 352 os << indent; 353 node->elsePart->accept( *this ); 354 --indent; 355 } // if 356 return node; 357 } 358 359 virtual const ast::Stmt * visit( const ast::WhileStmt * node ) { 360 return node; 361 } 362 363 virtual const ast::Stmt * visit( const ast::ForStmt * node ) { 364 return node; 365 } 366 367 virtual const ast::Stmt * visit( const ast::SwitchStmt * node ) { 368 return node; 369 } 370 371 virtual const ast::Stmt * visit( const ast::CaseStmt * node ) { 372 return node; 373 } 374 375 virtual const ast::Stmt * visit( const ast::BranchStmt * node ) { 376 return node; 377 } 378 379 virtual const ast::Stmt * visit( const ast::ReturnStmt * node ) { 380 return node; 381 } 382 383 virtual const ast::Stmt * visit( const ast::ThrowStmt * node ) { 384 return node; 385 } 386 387 virtual const ast::Stmt * visit( const ast::TryStmt * node ) { 388 return node; 389 } 390 391 virtual const ast::Stmt * visit( const ast::CatchStmt * node ) { 392 return node; 393 } 394 395 virtual const ast::Stmt * visit( const ast::FinallyStmt * node ) { 396 return node; 397 } 398 399 virtual const ast::Stmt * visit( const ast::WaitForStmt * node ) { 400 return node; 401 } 402 403 virtual const ast::Stmt * visit( const ast::WithStmt * node ) { 404 return node; 405 } 406 407 virtual const ast::NullStmt * visit( const ast::NullStmt * node ) { 408 return node; 409 } 410 411 virtual const ast::Stmt * visit( const ast::DeclStmt * node ) { 412 return node; 413 } 414 415 virtual const ast::Stmt * visit( const ast::ImplicitCtorDtorStmt * node ) { 416 return node; 417 } 418 419 virtual const ast::Expr * visit( const ast::ApplicationExpr * node ) { 420 return node; 421 } 422 423 virtual const ast::Expr * visit( const ast::UntypedExpr * node ) { 424 return node; 425 } 426 427 virtual const ast::Expr * visit( const ast::NameExpr * node ) { 428 return node; 429 } 430 431 virtual const ast::Expr * visit( const ast::AddressExpr * node ) { 432 return node; 433 } 434 435 virtual const ast::Expr * visit( const ast::LabelAddressExpr * node ) { 436 return node; 437 } 438 439 virtual const ast::Expr * visit( const ast::CastExpr * node ) { 440 return node; 441 } 442 443 virtual const ast::Expr * visit( const ast::KeywordCastExpr * node ) { 444 return node; 445 } 446 447 virtual const ast::Expr * visit( const ast::VirtualCastExpr * node ) { 448 return node; 449 } 450 451 virtual const ast::Expr * visit( const ast::UntypedMemberExpr * node ) { 452 return node; 453 } 454 455 virtual const ast::Expr * visit( const ast::MemberExpr * node ) { 456 return node; 457 } 458 459 virtual const ast::Expr * visit( const ast::VariableExpr * node ) { 460 return node; 461 } 462 463 virtual const ast::Expr * visit( const ast::ConstantExpr * node ) { 464 return node; 465 } 466 467 virtual const ast::Expr * visit( const ast::SizeofExpr * node ) { 468 return node; 469 } 470 471 virtual const ast::Expr * visit( const ast::AlignofExpr * node ) { 472 return node; 473 } 474 475 virtual const ast::Expr * visit( const ast::UntypedOffsetofExpr * node ) { 476 return node; 477 } 478 479 virtual const ast::Expr * visit( const ast::OffsetofExpr * node ) { 480 return node; 481 } 482 483 virtual const ast::Expr * visit( const ast::OffsetPackExpr * node ) { 484 return node; 485 } 486 487 virtual const ast::Expr * visit( const ast::LogicalExpr * node ) { 488 return node; 489 } 490 491 virtual const ast::Expr * visit( const ast::ConditionalExpr * node ) { 492 return node; 493 } 494 495 virtual const ast::Expr * visit( const ast::CommaExpr * node ) { 496 return node; 497 } 498 499 virtual const ast::Expr * visit( const ast::TypeExpr * node ) { 500 return node; 501 } 502 503 virtual const ast::Expr * visit( const ast::AsmExpr * node ) { 504 return node; 505 } 506 507 virtual const ast::Expr * visit( const ast::ImplicitCopyCtorExpr * node ) { 508 return node; 509 } 510 511 virtual const ast::Expr * visit( const ast::ConstructorExpr * node ) { 512 return node; 513 } 514 515 virtual const ast::Expr * visit( const ast::CompoundLiteralExpr * node ) { 516 return node; 517 } 518 519 virtual const ast::Expr * visit( const ast::RangeExpr * node ) { 520 return node; 521 } 522 523 virtual const ast::Expr * visit( const ast::UntypedTupleExpr * node ) { 524 return node; 525 } 526 527 virtual const ast::Expr * visit( const ast::TupleExpr * node ) { 528 return node; 529 } 530 531 virtual const ast::Expr * visit( const ast::TupleIndexExpr * node ) { 532 return node; 533 } 534 535 virtual const ast::Expr * visit( const ast::TupleAssignExpr * node ) { 536 return node; 537 } 538 539 virtual const ast::Expr * visit( const ast::StmtExpr * node ) { 540 return node; 541 } 542 543 virtual const ast::Expr * visit( const ast::UniqueExpr * node ) { 544 return node; 545 } 546 547 virtual const ast::Expr * visit( const ast::UntypedInitExpr * node ) { 548 return node; 549 } 550 551 virtual const ast::Expr * visit( const ast::InitExpr * node ) { 552 return node; 553 } 554 555 virtual const ast::Expr * visit( const ast::DeletedExpr * node ) { 556 return node; 557 } 558 559 virtual const ast::Expr * visit( const ast::DefaultArgExpr * node ) { 560 return node; 561 } 562 563 virtual const ast::Expr * visit( const ast::GenericExpr * node ) { 564 return node; 565 } 566 567 virtual const ast::Type * visit( const ast::VoidType * node ) { 568 return node; 569 } 570 571 virtual const ast::Type * visit( const ast::BasicType * node ) { 572 return node; 573 } 574 575 virtual const ast::Type * visit( const ast::PointerType * node ) { 576 return node; 577 } 578 579 virtual const ast::Type * visit( const ast::ArrayType * node ) { 580 return node; 581 } 582 583 virtual const ast::Type * visit( const ast::ReferenceType * node ) { 584 return node; 585 } 586 587 virtual const ast::Type * visit( const ast::QualifiedType * node ) { 588 return node; 589 } 590 591 virtual const ast::Type * visit( const ast::FunctionType * node ) { 592 return node; 593 } 594 595 virtual const ast::Type * visit( const ast::StructInstType * node ) { 596 return node; 597 } 598 599 virtual const ast::Type * visit( const ast::UnionInstType * node ) { 600 return node; 601 } 602 603 virtual const ast::Type * visit( const ast::EnumInstType * node ) { 604 return node; 605 } 606 607 virtual const ast::Type * visit( const ast::TraitInstType * node ) { 608 return node; 609 } 610 611 virtual const ast::Type * visit( const ast::TypeInstType * node ) { 612 return node; 613 } 614 615 virtual const ast::Type * visit( const ast::TupleType * node ) { 616 return node; 617 } 618 619 virtual const ast::Type * visit( const ast::TypeofType * node ) { 620 return node; 621 } 622 623 virtual const ast::Type * visit( const ast::VarArgsType * node ) { 624 return node; 625 } 626 627 virtual const ast::Type * visit( const ast::ZeroType * node ) { 628 return node; 629 } 630 631 virtual const ast::Type * visit( const ast::OneType * node ) { 632 return node; 633 } 634 635 virtual const ast::Type * visit( const ast::GlobalScopeType * node ) { 636 return node; 637 } 638 639 virtual const ast::Designation * visit( const ast::Designation * node ) { 478 640 if ( node->designators.empty() ) return node; 479 641 os << "... designated by: " << std::endl; … … 488 650 } 489 651 490 virtual const ast::Init * visit( const ast::SingleInit* node ) {652 virtual const ast::Init * visit( const ast::SingleInit * node ) { 491 653 os << "Simple Initializer: "; 492 654 node->value->accept( *this ); … … 494 656 } 495 657 496 virtual const ast::Init * visit( const ast::ListInit* node ) {658 virtual const ast::Init * visit( const ast::ListInit * node ) { 497 659 os << "Compound initializer: " << std::endl; 498 660 ++indent; … … 512 674 } 513 675 514 virtual const ast::Init * visit( const ast::ConstructorInit* node ) {676 virtual const ast::Init * visit( const ast::ConstructorInit * node ) { 515 677 os << "Constructor initializer: " << std::endl; 516 678 if ( node->ctor ) { … … 537 699 } 538 700 539 virtual const ast::Attribute * visit( const ast::Attribute* node ) {701 virtual const ast::Attribute * visit( const ast::Attribute * node ) { 540 702 if ( node->empty() ) return node; 541 703 os << "Attribute with name: " << node->name; … … 548 710 } 549 711 550 virtual const ast::TypeSubstitution * visit( const ast::TypeSubstitution * node ) {712 virtual const ast::TypeSubstitution * visit( const ast::TypeSubstitution * node ) { 551 713 os << indent << "Types:" << std::endl; 552 714 for ( const auto& i : *node ) { … … 570 732 }; 571 733 572 void print( std::ostream & os, const ast::Node * node, Indenter indent ) { 573 Printer printer { os, indent }; 734 void print( ostream & os, const ast::Node * node, Indenter indent ) { 735 Printer printer { os, indent, false }; 736 node->accept(printer); 737 } 738 739 void printShort( ostream & os, const ast::Node * node, Indenter indent ) { 740 Printer printer { os, indent, true }; 574 741 node->accept(printer); 575 742 } … … 578 745 // The size here needs to be explicit but at least the compiler will produce an error 579 746 // if the wrong size is specified 580 constexpr std::array<const char*, 3> Printer::Names::FuncSpecifiers;581 constexpr std::array<const char*, 5> Printer::Names::StorageClasses;582 constexpr std::array<const char*, 6> Printer::Names::Qualifiers;747 constexpr array<const char*, 3> Printer::Names::FuncSpecifiers; 748 constexpr array<const char*, 5> Printer::Names::StorageClasses; 749 constexpr array<const char*, 6> Printer::Names::Qualifiers; 583 750 } -
src/AST/module.mk
r0b57626 ra2e758e 21 21 AST/DeclReplacer.cpp \ 22 22 AST/Expr.cpp \ 23 AST/GenericSubstitution.cpp \ 23 24 AST/Init.cpp \ 24 25 AST/LinkageSpec.cpp \ -
src/Makefile.in
r0b57626 ra2e758e 167 167 am__objects_1 = AST/Attribute.$(OBJEXT) AST/Convert.$(OBJEXT) \ 168 168 AST/Decl.$(OBJEXT) AST/DeclReplacer.$(OBJEXT) \ 169 AST/Expr.$(OBJEXT) AST/Init.$(OBJEXT) \ 170 AST/LinkageSpec.$(OBJEXT) AST/Node.$(OBJEXT) \ 171 AST/Pass.$(OBJEXT) AST/Print.$(OBJEXT) AST/Stmt.$(OBJEXT) \ 172 AST/Type.$(OBJEXT) AST/TypeSubstitution.$(OBJEXT) 169 AST/Expr.$(OBJEXT) AST/GenericSubstitution.$(OBJEXT) \ 170 AST/Init.$(OBJEXT) AST/LinkageSpec.$(OBJEXT) \ 171 AST/Node.$(OBJEXT) AST/Pass.$(OBJEXT) AST/Print.$(OBJEXT) \ 172 AST/Stmt.$(OBJEXT) AST/Type.$(OBJEXT) \ 173 AST/TypeSubstitution.$(OBJEXT) 173 174 am__objects_2 = CodeGen/CodeGenerator.$(OBJEXT) \ 174 175 CodeGen/FixMain.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \ … … 574 575 AST/DeclReplacer.cpp \ 575 576 AST/Expr.cpp \ 577 AST/GenericSubstitution.cpp \ 576 578 AST/Init.cpp \ 577 579 AST/LinkageSpec.cpp \ … … 739 741 AST/$(DEPDIR)/$(am__dirstamp) 740 742 AST/Expr.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp) 743 AST/GenericSubstitution.$(OBJEXT): AST/$(am__dirstamp) \ 744 AST/$(DEPDIR)/$(am__dirstamp) 741 745 AST/Init.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp) 742 746 AST/LinkageSpec.$(OBJEXT): AST/$(am__dirstamp) \ … … 1173 1177 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/DeclReplacer.Po@am__quote@ 1174 1178 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Expr.Po@am__quote@ 1179 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/GenericSubstitution.Po@am__quote@ 1175 1180 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Init.Po@am__quote@ 1176 1181 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/LinkageSpec.Po@am__quote@
Note:
See TracChangeset
for help on using the changeset viewer.