Changeset 406a6e6
- Timestamp:
- Aug 14, 2017, 2:44:40 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 6a36975
- Parents:
- bd46af4
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
rbd46af4 r406a6e6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 12 10:37:00 201713 // Update Count : 6 412 // Last Modified On : Mon Aug 14 12:26:00 2017 13 // Update Count : 65 14 14 // 15 15 … … 329 329 void TryStmt::print( std::ostream &os, int indent ) const { 330 330 os << "Try Statement" << endl; 331 os << string( indent + 2, ' ' ) << "with block: " << endl; 331 os << string( indent + 2, ' ' ) << "with block:" << endl; 332 os << string( indent + 4, ' ' ); 332 333 block->print( os, indent + 4 ); 333 334 334 335 // handlers 335 os << string( indent + 2, ' ' ) << "and handlers: " << endl; 336 for ( std::list<CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++) 336 os << string( indent + 2, ' ' ) << "and handlers:" << endl; 337 for ( std::list<CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++) { 338 os << string( indent + 4, ' ' ); 337 339 (*i )->print( os, indent + 4 ); 340 } 338 341 339 342 // finally block 340 343 if ( finallyBlock != 0 ) { 341 os << string( indent + 2, ' ' ) << " Finally block:" << endl;344 os << string( indent + 2, ' ' ) << "and finally:" << endl; 342 345 finallyBlock->print( os, indent + 4 ); 343 346 } // if … … 360 363 os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl; 361 364 362 os << string( indent , ' ' ) << "... catching" << endl;365 os << string( indent + 2, ' ' ) << "... catching: "; 363 366 if ( decl ) { 364 367 decl->printShort( os, indent + 4 ); … … 367 370 else 368 371 os << string( indent + 4 , ' ' ) << ">>> Error: this catch clause must have a declaration <<<" << endl; 372 373 if ( cond ) { 374 os << string( indent + 2, ' ' ) << "with conditional:" << endl; 375 os << string( indent + 4, ' ' ); 376 cond->print( os, indent + 4 ); 377 } 378 else 379 os << string( indent + 2, ' ' ) << "with no conditional" << endl; 380 381 os << string( indent + 2, ' ' ) << "with block:" << endl; 382 os << string( indent + 4, ' ' ); 383 body->print( os, indent + 4 ); 369 384 } 370 385 … … 383 398 void FinallyStmt::print( std::ostream &os, int indent ) const { 384 399 os << "Finally Statement" << endl; 385 os << string( indent + 2, ' ' ) << "with block: " << endl; 400 os << string( indent + 2, ' ' ) << "with block:" << endl; 401 os << string( indent + 4, ' ' ); 386 402 block->print( os, indent + 4 ); 387 403 } -
src/tests/except-2.c
rbd46af4 r406a6e6 5 5 6 6 // Local Exception Types and manual vtable types. 7 #define GLUE2(left, right) left##right 8 #define GLUE3(left, middle, right) left##middle##right 7 9 #define BASE_EXCEPT __cfaehm__base_exception_t 8 #define TABLE(name) name##_vtable9 #define INSTANCE(name) _##name##_vtable_instance10 #define TABLE(name) GLUE2(name,_vtable) 11 #define INSTANCE(name) GLUE3(_,name,_vtable_instance) 10 12 #define TRIVIAL_EXCEPTION(name) \ 11 13 struct name; \ 12 14 struct TABLE(name) { \ 13 struct __cfaehm__base_exception_t_vtableconst * parent; \15 struct TABLE(BASE_EXCEPT) const * parent; \ 14 16 size_t size; \ 15 17 void (*copy)(name *this, name * other); \ … … 28 30 } \ 29 31 TABLE(name) INSTANCE(name) @= { \ 30 .parent : &INSTANCE( __cfaehm__base_exception_t), \32 .parent : &INSTANCE(BASE_EXCEPT), \ 31 33 .size : sizeof(name), .copy : name##_copy, \ 32 34 .free : ^?{}, .msg : name##_msg \ … … 40 42 struct num_error; 41 43 struct num_error_vtable { 42 struct exception_t_vtableconst * parent;44 struct TABLE(BASE_EXCEPT) const * parent; 43 45 size_t size; 44 46 void (*copy)(num_error *this, num_error * other); … … 62 64 } 63 65 void ?{}(num_error * this, int num) { 64 this->virtual_table = & _num_error_vtable_instance;66 this->virtual_table = &INSTANCE(num_error); 65 67 this->msg = 0; 66 68 this->num = num;
Note: See TracChangeset
for help on using the changeset viewer.