- Timestamp:
- Feb 4, 2020, 11:35:26 AM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- eef8dfb
- Parents:
- aefb247 (diff), 4f7b418 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/Stats/Time.h
raefb247 rbdfc032 9 9 // Author : Thierry Delisle 10 10 // Created On : Fri Mar 01 15:14:11 2019 11 // Last Modified By : 11 // Last Modified By : Andrew Beach 12 12 // Last Modified On : 13 13 // Update Count : … … 41 41 f(); 42 42 } 43 44 template<typename ret_t = void, typename func_t, typename... arg_t> 45 inline ret_t TimeCall( 46 const char *, func_t func, arg_t&&... arg) { 47 return func(std::forward<arg_t>(arg)...); 48 } 43 49 # else 44 50 void StartGlobal(); … … 59 65 func(); 60 66 } 67 68 template<typename ret_t = void, typename func_t, typename... arg_t> 69 inline ret_t TimeCall( 70 const char * name, func_t func, arg_t&&... arg) { 71 BlockGuard guard(name); 72 return func(std::forward<arg_t>(arg)...); 73 } 61 74 # endif 62 75 } -
src/Concurrency/Keywords.cc
raefb247 rbdfc032 716 716 new UntypedExpr( 717 717 new NameExpr( "__thrd_start" ), 718 { new VariableExpr( param ) }718 { new VariableExpr( param ), new NameExpr("main") } 719 719 ) 720 720 ) -
src/Concurrency/Waitfor.cc
raefb247 rbdfc032 11 11 // Last Modified By : 12 12 // Last Modified On : 13 // Update Count : 1 113 // Update Count : 12 14 14 // 15 15 … … 42 42 void foo() { 43 43 while( true ) { 44 when( a < 1 ) waitfor( f ,a ) { bar(); }44 when( a < 1 ) waitfor( f : a ) { bar(); } 45 45 or timeout( swagl() ); 46 or waitfor( g ,a ) { baz(); }47 or waitfor( ^?{} ,a ) { break; }46 or waitfor( g : a ) { baz(); } 47 or waitfor( ^?{} : a ) { break; } 48 48 or waitfor( ^?{} ) { break; } 49 49 } -
src/ControlStruct/LabelFixer.cc
raefb247 rbdfc032 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon Mar 11 22:26:02 201913 // Update Count : 1 5911 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Jan 21 10:32:00 2020 13 // Update Count : 160 14 14 // 15 15 … … 21 21 #include "ControlStruct/LabelGenerator.h" // for LabelGenerator 22 22 #include "LabelFixer.h" 23 #include "MLEMutator.h" // for M LEMutator23 #include "MLEMutator.h" // for MultiLevelExitMutator 24 24 #include "SynTree/Declaration.h" // for FunctionDecl 25 25 #include "SynTree/Expression.h" // for NameExpr, Expression, Unty... … … 44 44 45 45 void LabelFixer::postvisit( FunctionDecl * functionDecl ) { 46 PassVisitor<MLEMutator> mlemut( resolveJumps(), generator ); 47 functionDecl->acceptMutator( mlemut ); 46 PassVisitor<MultiLevelExitMutator> mlem( resolveJumps(), generator ); 47 // We start in the body so we can stop when we hit another FunctionDecl. 48 maybeMutate( functionDecl->statements, mlem ); 48 49 } 49 50 … … 75 76 76 77 77 // sets the definition of the labelTable entry to be the provided statement for every label in the list78 // parameter. Happens for every kind of statement78 // Sets the definition of the labelTable entry to be the provided statement for every label in 79 // the list parameter. Happens for every kind of statement. 79 80 Label LabelFixer::setLabelsDef( std::list< Label > & llabel, Statement * definition ) { 80 81 assert( definition != 0 ); 81 82 assert( llabel.size() > 0 ); 82 83 Entry * e = new Entry( definition );84 83 85 84 for ( std::list< Label >::iterator i = llabel.begin(); i != llabel.end(); i++ ) { … … 87 86 l.set_statement( definition ); // attach statement to the label to be used later 88 87 if ( labelTable.find( l ) == labelTable.end() ) { 89 // all labels on this statement need to use the same entry, so this should only be created once 88 // All labels on this statement need to use the same entry, 89 // so this should only be created once. 90 90 // undefined and unused until now, add an entry 91 labelTable[ l ] = e;91 labelTable[ l ] = new Entry( definition ); 92 92 } else if ( labelTable[ l ]->defined() ) { 93 93 // defined twice, error 94 SemanticError( l.get_statement()->location, "Duplicate definition of label: " + l.get_name() ); 95 } else { 94 SemanticError( l.get_statement()->location, 95 "Duplicate definition of label: " + l.get_name() ); 96 } else { 96 97 // used previously, but undefined until now -> link with this entry 98 // Question: Is changing objects important? 97 99 delete labelTable[ l ]; 98 labelTable[ l ] = e;100 labelTable[ l ] = new Entry( definition ); 99 101 } // if 100 102 } // for 101 103 102 // produce one of the labels attached to this statement to be temporarily used as the canonical label 104 // Produce one of the labels attached to this statement to be temporarily used as the 105 // canonical label. 103 106 return labelTable[ llabel.front() ]->get_label(); 104 107 } -
src/ControlStruct/MLEMutator.cc
raefb247 rbdfc032 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue Oct 22 17:22:44 201913 // Update Count : 22 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jan 22 11:50:00 2020 13 // Update Count : 223 14 14 // 15 15 … … 33 33 34 34 namespace ControlStruct { 35 M LEMutator::~MLEMutator() {35 MultiLevelExitMutator::~MultiLevelExitMutator() { 36 36 delete targetTable; 37 37 targetTable = 0; 38 38 } 39 39 namespace { 40 bool isLoop( const MLEMutator::Entry & e ) { return dynamic_cast< WhileStmt * >( e.get_controlStructure() ) || dynamic_cast< ForStmt * >( e.get_controlStructure() ); } 41 bool isSwitch( const MLEMutator::Entry & e ) { return dynamic_cast< SwitchStmt *>( e.get_controlStructure() ); } 42 43 bool isBreakTarget( const MLEMutator::Entry & e ) { return isLoop( e ) || isSwitch( e ) || dynamic_cast< CompoundStmt *>( e.get_controlStructure() ); } 44 bool isContinueTarget( const MLEMutator::Entry & e ) { return isLoop( e ); } 45 bool isFallthroughTarget( const MLEMutator::Entry & e ) { return dynamic_cast< CaseStmt *>( e.get_controlStructure() );; } 46 bool isFallthroughDefaultTarget( const MLEMutator::Entry & e ) { return isSwitch( e ); } 40 bool isLoop( const MultiLevelExitMutator::Entry & e ) { 41 return dynamic_cast< WhileStmt * >( e.get_controlStructure() ) 42 || dynamic_cast< ForStmt * >( e.get_controlStructure() ); 43 } 44 bool isSwitch( const MultiLevelExitMutator::Entry & e ) { 45 return dynamic_cast< SwitchStmt *>( e.get_controlStructure() ); 46 } 47 48 bool isBreakTarget( const MultiLevelExitMutator::Entry & e ) { 49 return isLoop( e ) || isSwitch( e ) 50 || dynamic_cast< CompoundStmt *>( e.get_controlStructure() ); 51 } 52 bool isContinueTarget( const MultiLevelExitMutator::Entry & e ) { 53 return isLoop( e ); 54 } 55 bool isFallthroughTarget( const MultiLevelExitMutator::Entry & e ) { 56 return dynamic_cast< CaseStmt *>( e.get_controlStructure() ); 57 } 58 bool isFallthroughDefaultTarget( const MultiLevelExitMutator::Entry & e ) { 59 return isSwitch( e ); 60 } 47 61 } // namespace 62 63 void MultiLevelExitMutator::premutate( FunctionDecl * ) { 64 visit_children = false; 65 } 48 66 49 67 // break labels have to come after the statement they break out of, so mutate a statement, then if they inform us 50 68 // through the breakLabel field tha they need a place to jump to on a break statement, add the break label to the 51 69 // body of statements 52 void M LEMutator::fixBlock( std::list< Statement * > &kids, bool caseClause ) {70 void MultiLevelExitMutator::fixBlock( std::list< Statement * > &kids, bool caseClause ) { 53 71 SemanticErrorException errors; 54 72 … … 81 99 } 82 100 83 void M LEMutator::premutate( CompoundStmt *cmpndStmt ) {101 void MultiLevelExitMutator::premutate( CompoundStmt *cmpndStmt ) { 84 102 visit_children = false; 85 103 bool labeledBlock = !(cmpndStmt->labels.empty()); … … 118 136 } 119 137 } 120 assertf( false, "Could not find label '%s' on statement %s", originalTarget.get_name().c_str(), toString( stmt ).c_str() ); 121 } 122 123 124 Statement *MLEMutator::postmutate( BranchStmt *branchStmt ) throw ( SemanticErrorException ) { 138 assertf( false, "Could not find label '%s' on statement %s", 139 originalTarget.get_name().c_str(), toString( stmt ).c_str() ); 140 } 141 142 143 Statement *MultiLevelExitMutator::postmutate( BranchStmt *branchStmt ) 144 throw ( SemanticErrorException ) { 125 145 std::string originalTarget = branchStmt->originalTarget; 126 146 … … 230 250 } 231 251 232 Statement *M LEMutator::mutateLoop( Statement *bodyLoop, Entry &e ) {252 Statement *MultiLevelExitMutator::mutateLoop( Statement *bodyLoop, Entry &e ) { 233 253 // only generate these when needed 234 254 if( !e.isContUsed() && !e.isBreakUsed() ) return bodyLoop; … … 253 273 254 274 template< typename LoopClass > 255 void M LEMutator::prehandleLoopStmt( LoopClass * loopStmt ) {275 void MultiLevelExitMutator::prehandleLoopStmt( LoopClass * loopStmt ) { 256 276 // remember this as the most recent enclosing loop, then mutate the body of the loop -- this will determine 257 277 // whether brkLabel and contLabel are used with branch statements and will recursively do the same to nested … … 264 284 265 285 template< typename LoopClass > 266 Statement * M LEMutator::posthandleLoopStmt( LoopClass * loopStmt ) {286 Statement * MultiLevelExitMutator::posthandleLoopStmt( LoopClass * loopStmt ) { 267 287 assert( ! enclosingControlStructures.empty() ); 268 288 Entry &e = enclosingControlStructures.back(); … … 275 295 } 276 296 277 void M LEMutator::premutate( WhileStmt * whileStmt ) {297 void MultiLevelExitMutator::premutate( WhileStmt * whileStmt ) { 278 298 return prehandleLoopStmt( whileStmt ); 279 299 } 280 300 281 void M LEMutator::premutate( ForStmt * forStmt ) {301 void MultiLevelExitMutator::premutate( ForStmt * forStmt ) { 282 302 return prehandleLoopStmt( forStmt ); 283 303 } 284 304 285 Statement * M LEMutator::postmutate( WhileStmt * whileStmt ) {305 Statement * MultiLevelExitMutator::postmutate( WhileStmt * whileStmt ) { 286 306 return posthandleLoopStmt( whileStmt ); 287 307 } 288 308 289 Statement * M LEMutator::postmutate( ForStmt * forStmt ) {309 Statement * MultiLevelExitMutator::postmutate( ForStmt * forStmt ) { 290 310 return posthandleLoopStmt( forStmt ); 291 311 } 292 312 293 void M LEMutator::premutate( IfStmt * ifStmt ) {313 void MultiLevelExitMutator::premutate( IfStmt * ifStmt ) { 294 314 // generate a label for breaking out of a labeled if 295 315 bool labeledBlock = !(ifStmt->get_labels().empty()); … … 301 321 } 302 322 303 Statement * M LEMutator::postmutate( IfStmt * ifStmt ) {323 Statement * MultiLevelExitMutator::postmutate( IfStmt * ifStmt ) { 304 324 bool labeledBlock = !(ifStmt->get_labels().empty()); 305 325 if ( labeledBlock ) { … … 311 331 } 312 332 313 void M LEMutator::premutate( TryStmt * tryStmt ) {333 void MultiLevelExitMutator::premutate( TryStmt * tryStmt ) { 314 334 // generate a label for breaking out of a labeled if 315 335 bool labeledBlock = !(tryStmt->get_labels().empty()); … … 321 341 } 322 342 323 Statement * M LEMutator::postmutate( TryStmt * tryStmt ) {343 Statement * MultiLevelExitMutator::postmutate( TryStmt * tryStmt ) { 324 344 bool labeledBlock = !(tryStmt->get_labels().empty()); 325 345 if ( labeledBlock ) { … … 331 351 } 332 352 333 void MLEMutator::premutate( CaseStmt *caseStmt ) { 353 void MultiLevelExitMutator::premutate( FinallyStmt * ) { 354 GuardAction([this, old = std::move(enclosingControlStructures)]() { 355 enclosingControlStructures = std::move(old); 356 }); 357 enclosingControlStructures = std::list<Entry>(); 358 GuardValue( inFinally ); 359 inFinally = true; 360 } 361 362 void MultiLevelExitMutator::premutate( ReturnStmt *returnStmt ) { 363 if ( inFinally ) { 364 SemanticError( returnStmt->location, "'return' may not appear in a finally clause" ); 365 } 366 } 367 368 void MultiLevelExitMutator::premutate( CaseStmt *caseStmt ) { 334 369 visit_children = false; 335 370 … … 370 405 } 371 406 372 void M LEMutator::premutate( SwitchStmt *switchStmt ) {407 void MultiLevelExitMutator::premutate( SwitchStmt *switchStmt ) { 373 408 // generate a label for breaking out of a labeled switch 374 409 Label brkLabel = generator->newLabel("switchBreak", switchStmt); … … 396 431 } 397 432 398 Statement * M LEMutator::postmutate( SwitchStmt * switchStmt ) {433 Statement * MultiLevelExitMutator::postmutate( SwitchStmt * switchStmt ) { 399 434 Entry &e = enclosingControlStructures.back(); 400 435 assert ( e == switchStmt ); -
src/ControlStruct/MLEMutator.h
raefb247 rbdfc032 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue Oct 22 17:22:47 201913 // Update Count : 4 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jan 22 11:50:00 2020 13 // Update Count : 48 14 14 // 15 15 … … 30 30 class LabelGenerator; 31 31 32 class MLEMutator : public WithVisitorRef<MLEMutator>, public WithShortCircuiting, public WithGuards { 32 class MultiLevelExitMutator : public WithVisitorRef<MultiLevelExitMutator>, 33 public WithShortCircuiting, public WithGuards { 33 34 public: 34 35 class Entry; 35 MLEMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {} 36 ~MLEMutator(); 36 MultiLevelExitMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : 37 targetTable( t ), breakLabel(std::string("")), generator( gen ) {} 38 ~MultiLevelExitMutator(); 39 40 void premutate( FunctionDecl * ); 37 41 38 42 void premutate( CompoundStmt *cmpndStmt ); … … 47 51 void premutate( SwitchStmt *switchStmt ); 48 52 Statement * postmutate( SwitchStmt *switchStmt ); 53 void premutate( ReturnStmt *returnStmt ); 49 54 void premutate( TryStmt *tryStmt ); 50 55 Statement * postmutate( TryStmt *tryStmt ); 56 void premutate( FinallyStmt *finallyStmt ); 51 57 52 58 Statement *mutateLoop( Statement *bodyLoop, Entry &e ); … … 110 116 Label breakLabel; 111 117 LabelGenerator *generator; 118 bool inFinally = false; 112 119 113 120 template< typename LoopClass > -
src/Parser/lex.ll
raefb247 rbdfc032 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : S un Aug 4 20:53:47 201913 * Update Count : 7 1912 * Last Modified On : Sat Feb 1 07:16:44 2020 13 * Update Count : 724 14 14 */ 15 15 … … 330 330 /* identifier */ 331 331 {identifier} { IDENTIFIER_RETURN(); } 332 "` "{identifier}"`" { // CFA333 yytext[yyleng - 1] = '\0'; yytext += 1; // SKULLDUGGERY: remove backquotes (ok to shorten?)332 "``"{identifier}"``" { // CFA 333 yytext[yyleng - 2] = '\0'; yytext += 2; // SKULLDUGGERY: remove backquotes (ok to shorten?) 334 334 IDENTIFIER_RETURN(); 335 335 } -
src/Parser/parser.yy
raefb247 rbdfc032 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Dec 16 15:32:58 201913 // Update Count : 44 0912 // Last Modified On : Sat Feb 1 10:04:40 2020 13 // Update Count : 4440 14 14 // 15 15 … … 323 323 %type<op> ptrref_operator unary_operator assignment_operator 324 324 %type<en> primary_expression postfix_expression unary_expression 325 %type<en> cast_expression exponential_expression multiplicative_expression additive_expression325 %type<en> cast_expression_list cast_expression exponential_expression multiplicative_expression additive_expression 326 326 %type<en> shift_expression relational_expression equality_expression 327 327 %type<en> AND_expression exclusive_OR_expression inclusive_OR_expression … … 579 579 | '(' compound_statement ')' // GCC, lambda expression 580 580 { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); } 581 | constant '`' IDENTIFIER // CFA, postfix call582 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }583 | string_literal '`' IDENTIFIER // CFA, postfix call584 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }585 | IDENTIFIER '`' IDENTIFIER // CFA, postfix call586 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( build_varref( $1 ) ) ) ); }587 | tuple '`' IDENTIFIER // CFA, postfix call588 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }589 | '(' comma_expression ')' '`' IDENTIFIER // CFA, postfix call590 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }591 581 | type_name '.' identifier // CFA, nested type 592 582 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; } … … 642 632 | postfix_expression '(' argument_expression_list ')' 643 633 { $$ = new ExpressionNode( build_func( $1, $3 ) ); } 634 | postfix_expression '`' identifier // CFA, postfix call 635 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); } 636 | constant '`' identifier // CFA, postfix call 637 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); } 638 | string_literal '`' identifier // CFA, postfix call 639 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); } 644 640 | postfix_expression '.' identifier 645 641 { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); } … … 666 662 | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal 667 663 { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); } 668 | '^' primary_expression '{' argument_expression_list '}' // CFA 664 | '^' primary_expression '{' argument_expression_list '}' // CFA, destructor call 669 665 { 670 666 Token fn; … … 679 675 | argument_expression 680 676 | argument_expression_list ',' argument_expression 681 { $$ = (ExpressionNode *)( 677 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 682 678 ; 683 679 … … 691 687 field_name_list: // CFA, tuple field selector 692 688 field 693 | field_name_list ',' field { $$ = (ExpressionNode *) $1->set_last( $3); }689 | field_name_list ',' field { $$ = (ExpressionNode *)($1->set_last( $3 )); } 694 690 ; 695 691 … … 960 956 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); } 961 957 | '[' push assignment_expression pop ',' tuple_expression_list ']' 962 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *) $3->set_last( $6 ) )); }958 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $6 ) ) )); } 963 959 ; 964 960 … … 966 962 assignment_expression_opt 967 963 | tuple_expression_list ',' assignment_expression_opt 968 { $$ = (ExpressionNode *) $1->set_last( $3); }964 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 969 965 ; 970 966 … … 1307 1303 WAITFOR '(' cast_expression ')' 1308 1304 { $$ = $3; } 1309 | WAITFOR '(' cast_expression ',' argument_expression_list ')' 1310 { $$ = (ExpressionNode *)$3->set_last( $5 ); } 1305 // | WAITFOR '(' cast_expression ',' argument_expression_list ')' 1306 // { $$ = (ExpressionNode *)$3->set_last( $5 ); } 1307 | WAITFOR '(' cast_expression_list ':' argument_expression_list ')' 1308 { $$ = (ExpressionNode *)($3->set_last( $5 )); } 1309 ; 1310 1311 cast_expression_list: 1312 cast_expression 1313 | cast_expression_list ',' cast_expression 1314 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 1311 1315 ; 1312 1316 … … 1419 1423 asm_operand 1420 1424 | asm_operands_list ',' asm_operand 1421 { $$ = (ExpressionNode *) $1->set_last( $3); }1425 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 1422 1426 ; 1423 1427 … … 1435 1439 { $$ = new ExpressionNode( $1 ); } 1436 1440 | asm_clobbers_list_opt ',' string_literal 1437 // set_last returns ParseNode * 1438 { $$ = (ExpressionNode *)$1->set_last( new ExpressionNode( $3 ) ); } 1441 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( $3 ) )); } 1439 1442 ; 1440 1443 … … 2359 2362 | initializer_list_opt ',' initializer { $$ = (InitializerNode *)( $1->set_last( $3 ) ); } 2360 2363 | initializer_list_opt ',' designation initializer 2361 { $$ = (InitializerNode *)( $1->set_last( $4->set_designators( $3 ) )); }2364 { $$ = (InitializerNode *)($1->set_last( $4->set_designators( $3 ) )); } 2362 2365 ; 2363 2366 … … 2381 2384 designator 2382 2385 | designator_list designator 2383 { $$ = (ExpressionNode *)( $1->set_last( $2 )); }2386 { $$ = (ExpressionNode *)($1->set_last( $2 )); } 2384 2387 //| designator_list designator { $$ = new ExpressionNode( $1, $2 ); } 2385 2388 ; … … 2478 2481 { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $1->build()) ); $$ = nullptr; } 2479 2482 | type_list ',' type 2480 { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }2483 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); } 2481 2484 | type_list ',' assignment_expression 2482 2485 { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $3->build()) ); $$ = nullptr; } -
src/SymTab/Validate.cc
raefb247 rbdfc032 375 375 Stats::Heap::newPass("validate-F"); 376 376 Stats::Time::BlockGuard guard("validate-F"); 377 Stats::Time::TimeBlock("Fix Object Type", [&]() { 378 FixObjectType::fix( translationUnit ); 379 }); 380 Stats::Time::TimeBlock("Array Length", [&]() { 381 ArrayLength::computeLength( translationUnit ); 382 }); 383 Stats::Time::TimeBlock("Find Special Declarations", [&]() { 384 Validate::findSpecialDecls( translationUnit ); 385 }); 386 Stats::Time::TimeBlock("Fix Label Address", [&]() { 387 mutateAll( translationUnit, labelAddrFixer ); 388 }); 389 Stats::Time::TimeBlock("Handle Attributes", [&]() { 390 Validate::handleAttributes( translationUnit ); 391 }); 377 Stats::Time::TimeCall("Fix Object Type", 378 FixObjectType::fix, translationUnit); 379 Stats::Time::TimeCall("Array Length", 380 ArrayLength::computeLength, translationUnit); 381 Stats::Time::TimeCall("Find Special Declarations", 382 Validate::findSpecialDecls, translationUnit); 383 Stats::Time::TimeCall("Fix Label Address", 384 mutateAll<LabelAddressFixer>, translationUnit, labelAddrFixer); 385 Stats::Time::TimeCall("Handle Attributes", 386 Validate::handleAttributes, translationUnit); 392 387 } 393 388 } -
src/SynTree/Statement.cc
raefb247 rbdfc032 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sun Sep 3 20:46:44 201713 // Update Count : 6811 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jan 20 16:03:00 2020 13 // Update Count : 71 14 14 // 15 15 … … 46 46 Statement::~Statement() {} 47 47 48 ExprStmt::ExprStmt( Expression * expr ) : Statement(), expr( expr ) {}49 50 ExprStmt::ExprStmt( const ExprStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}48 ExprStmt::ExprStmt( Expression * expr ) : Statement(), expr( expr ) {} 49 50 ExprStmt::ExprStmt( const ExprStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {} 51 51 52 52 ExprStmt::~ExprStmt() { … … 54 54 } 55 55 56 void ExprStmt::print( std::ostream & os, Indenter indent ) const {56 void ExprStmt::print( std::ostream & os, Indenter indent ) const { 57 57 os << "Expression Statement:" << endl << indent+1; 58 58 expr->print( os, indent+1 ); … … 60 60 61 61 62 AsmStmt::AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {}62 AsmStmt::AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {} 63 63 64 64 AsmStmt::AsmStmt( const AsmStmt & other ) : Statement( other ), voltile( other.voltile ), instruction( maybeClone( other.instruction ) ), gotolabels( other.gotolabels ) { … … 75 75 } 76 76 77 void AsmStmt::print( std::ostream & os, Indenter indent ) const {77 void AsmStmt::print( std::ostream & os, Indenter indent ) const { 78 78 os << "Assembler Statement:" << endl; 79 79 os << indent+1 << "instruction: " << endl << indent; … … 96 96 DirectiveStmt::DirectiveStmt( const std::string & directive ) : Statement(), directive( directive ) {} 97 97 98 void DirectiveStmt::print( std::ostream & os, Indenter ) const {98 void DirectiveStmt::print( std::ostream & os, Indenter ) const { 99 99 os << "GCC Directive:" << directive << endl; 100 100 } 101 101 102 102 103 const char *BranchStmt::brType[] = { "Goto", "Break", "Continue" }; 103 const char * BranchStmt::brType[] = { 104 "Goto", "Break", "Continue", "Fall Through", "Fall Through Default", 105 }; 104 106 105 107 BranchStmt::BranchStmt( Label target, Type type ) throw ( SemanticErrorException ) : … … 111 113 } 112 114 113 BranchStmt::BranchStmt( Expression * computedTarget, Type type ) throw ( SemanticErrorException ) :115 BranchStmt::BranchStmt( Expression * computedTarget, Type type ) throw ( SemanticErrorException ) : 114 116 Statement(), computedTarget( computedTarget ), type( type ) { 115 117 if ( type != BranchStmt::Goto || computedTarget == nullptr ) { … … 118 120 } 119 121 120 void BranchStmt::print( std::ostream &os, Indenter indent ) const { 122 void BranchStmt::print( std::ostream & os, Indenter indent ) const { 123 assert(type < 5); 121 124 os << "Branch (" << brType[type] << ")" << endl ; 122 125 if ( target != "" ) os << indent+1 << "with target: " << target << endl; … … 125 128 } 126 129 127 ReturnStmt::ReturnStmt( Expression * expr ) : Statement(), expr( expr ) {}130 ReturnStmt::ReturnStmt( Expression * expr ) : Statement(), expr( expr ) {} 128 131 129 132 ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {} … … 133 136 } 134 137 135 void ReturnStmt::print( std::ostream & os, Indenter indent ) const {138 void ReturnStmt::print( std::ostream & os, Indenter indent ) const { 136 139 os << "Return Statement, returning: "; 137 140 if ( expr != nullptr ) { … … 142 145 } 143 146 144 IfStmt::IfStmt( Expression * condition, Statement *thenPart, Statement *elsePart, std::list<Statement *> initialization ):147 IfStmt::IfStmt( Expression * condition, Statement * thenPart, Statement * elsePart, std::list<Statement *> initialization ): 145 148 Statement(), condition( condition ), thenPart( thenPart ), elsePart( elsePart ), initialization( initialization ) {} 146 149 … … 157 160 } 158 161 159 void IfStmt::print( std::ostream & os, Indenter indent ) const {162 void IfStmt::print( std::ostream & os, Indenter indent ) const { 160 163 os << "If on condition: " << endl; 161 164 os << indent+1; … … 176 179 thenPart->print( os, indent+1 ); 177 180 178 if ( elsePart != 0) {181 if ( elsePart != nullptr ) { 179 182 os << indent << "... else: " << endl; 180 183 os << indent+1; … … 183 186 } 184 187 185 SwitchStmt::SwitchStmt( Expression * condition, const std::list<Statement *> & statements ):188 SwitchStmt::SwitchStmt( Expression * condition, const std::list<Statement *> & statements ): 186 189 Statement(), condition( condition ), statements( statements ) { 187 190 } … … 198 201 } 199 202 200 void SwitchStmt::print( std::ostream & os, Indenter indent ) const {203 void SwitchStmt::print( std::ostream & os, Indenter indent ) const { 201 204 os << "Switch on condition: "; 202 205 condition->print( os ); … … 208 211 } 209 212 210 CaseStmt::CaseStmt( Expression * condition, const std::list<Statement *> &statements, bool deflt ) throw ( SemanticErrorException ) :213 CaseStmt::CaseStmt( Expression * condition, const std::list<Statement *> & statements, bool deflt ) throw ( SemanticErrorException ) : 211 214 Statement(), condition( condition ), stmts( statements ), _isDefault( deflt ) { 212 if ( isDefault() && condition != 0) SemanticError( condition, "default case with condition: " );215 if ( isDefault() && condition != nullptr ) SemanticError( condition, "default case with condition: " ); 213 216 } 214 217 … … 229 232 } 230 233 231 void CaseStmt::print( std::ostream & os, Indenter indent ) const {234 void CaseStmt::print( std::ostream & os, Indenter indent ) const { 232 235 if ( isDefault() ) os << indent << "Default "; 233 236 else { … … 243 246 } 244 247 245 WhileStmt::WhileStmt( Expression * condition, Statement *body, std::list< Statement * > & initialization, bool isDoWhile ):248 WhileStmt::WhileStmt( Expression * condition, Statement * body, std::list< Statement * > & initialization, bool isDoWhile ): 246 249 Statement(), condition( condition), body( body), initialization( initialization ), isDoWhile( isDoWhile) { 247 250 } … … 256 259 } 257 260 258 void WhileStmt::print( std::ostream & os, Indenter indent ) const {261 void WhileStmt::print( std::ostream & os, Indenter indent ) const { 259 262 os << "While on condition: " << endl ; 260 263 condition->print( os, indent+1 ); … … 262 265 os << indent << "... with body: " << endl; 263 266 264 if ( body != 0) body->print( os, indent+1 );265 } 266 267 ForStmt::ForStmt( std::list<Statement *> initialization, Expression * condition, Expression *increment, Statement *body ):267 if ( body != nullptr ) body->print( os, indent+1 ); 268 } 269 270 ForStmt::ForStmt( std::list<Statement *> initialization, Expression * condition, Expression * increment, Statement * body ): 268 271 Statement(), initialization( initialization ), condition( condition ), increment( increment ), body( body ) { 269 272 } … … 282 285 } 283 286 284 void ForStmt::print( std::ostream & os, Indenter indent ) const {287 void ForStmt::print( std::ostream & os, Indenter indent ) const { 285 288 Statement::print( os, indent ); // print labels 286 289 … … 305 308 } 306 309 307 if ( body != 0) {310 if ( body != nullptr ) { 308 311 os << "\n" << indent << "... with body: \n" << indent+1; 309 312 body->print( os, indent+1 ); … … 317 320 } 318 321 319 ThrowStmt::ThrowStmt( const ThrowStmt & other ) :322 ThrowStmt::ThrowStmt( const ThrowStmt & other ) : 320 323 Statement ( other ), kind( other.kind ), expr( maybeClone( other.expr ) ), target( maybeClone( other.target ) ) { 321 324 } … … 326 329 } 327 330 328 void ThrowStmt::print( std::ostream & os, Indenter indent) const {331 void ThrowStmt::print( std::ostream & os, Indenter indent) const { 329 332 if ( target ) os << "Non-Local "; 330 333 os << "Throw Statement, raising: "; … … 336 339 } 337 340 338 TryStmt::TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock ) :341 TryStmt::TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock ) : 339 342 Statement(), block( tryBlock ), handlers( handlers ), finallyBlock( finallyBlock ) { 340 343 } 341 344 342 TryStmt::TryStmt( const TryStmt & other ) : Statement( other ), block( maybeClone( other.block ) ), finallyBlock( maybeClone( other.finallyBlock ) ) {345 TryStmt::TryStmt( const TryStmt & other ) : Statement( other ), block( maybeClone( other.block ) ), finallyBlock( maybeClone( other.finallyBlock ) ) { 343 346 cloneAll( other.handlers, handlers ); 344 347 } … … 350 353 } 351 354 352 void TryStmt::print( std::ostream & os, Indenter indent ) const {355 void TryStmt::print( std::ostream & os, Indenter indent ) const { 353 356 os << "Try Statement" << endl; 354 357 os << indent << "... with block:" << endl << indent+1; … … 363 366 364 367 // finally block 365 if ( finallyBlock != 0) {368 if ( finallyBlock != nullptr ) { 366 369 os << indent << "... and finally:" << endl << indent+1; 367 370 finallyBlock->print( os, indent+1 ); … … 369 372 } 370 373 371 CatchStmt::CatchStmt( Kind kind, Declaration * decl, Expression *cond, Statement *body ) :374 CatchStmt::CatchStmt( Kind kind, Declaration * decl, Expression * cond, Statement * body ) : 372 375 Statement(), kind ( kind ), decl ( decl ), cond ( cond ), body( body ) { 373 376 assertf( decl, "Catch clause must have a declaration." ); … … 383 386 } 384 387 385 void CatchStmt::print( std::ostream & os, Indenter indent ) const {388 void CatchStmt::print( std::ostream & os, Indenter indent ) const { 386 389 os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl; 387 390 … … 401 404 402 405 403 FinallyStmt::FinallyStmt( CompoundStmt * block ) : Statement(), block( block ) {406 FinallyStmt::FinallyStmt( CompoundStmt * block ) : Statement(), block( block ) { 404 407 } 405 408 … … 411 414 } 412 415 413 void FinallyStmt::print( std::ostream & os, Indenter indent ) const {416 void FinallyStmt::print( std::ostream & os, Indenter indent ) const { 414 417 os << "Finally Statement" << endl; 415 418 os << indent << "... with block:" << endl << indent+1; … … 458 461 } 459 462 460 void WaitForStmt::print( std::ostream & os, Indenter indent ) const {463 void WaitForStmt::print( std::ostream & os, Indenter indent ) const { 461 464 os << "Waitfor Statement" << endl; 462 465 indent += 1; … … 514 517 } 515 518 516 void NullStmt::print( std::ostream & os, Indenter indent ) const {519 void NullStmt::print( std::ostream & os, Indenter indent ) const { 517 520 os << "Null Statement" << endl; 518 521 Statement::print( os, indent ); … … 530 533 } 531 534 532 void ImplicitCtorDtorStmt::print( std::ostream & os, Indenter indent ) const {535 void ImplicitCtorDtorStmt::print( std::ostream & os, Indenter indent ) const { 533 536 os << "Implicit Ctor Dtor Statement" << endl; 534 537 os << indent << "... with Ctor/Dtor: "; -
src/SynTree/Statement.h
raefb247 rbdfc032 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 12 09:01:53 201913 // Update Count : 8 312 // Last Modified On : Fri Jan 10 14:13:24 2020 13 // Update Count : 85 14 14 // 15 15 … … 257 257 Statement * body; 258 258 259 ForStmt( std::list<Statement *> initialization, Expression * condition = 0, Expression * increment = 0, Statement * body = 0);259 ForStmt( std::list<Statement *> initialization, Expression * condition = nullptr, Expression * increment = nullptr, Statement * body = nullptr ); 260 260 ForStmt( const ForStmt & other ); 261 261 virtual ~ForStmt(); … … 357 357 FinallyStmt * finallyBlock; 358 358 359 TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = 0);359 TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = nullptr ); 360 360 TryStmt( const TryStmt & other ); 361 361 virtual ~TryStmt(); -
src/cfa.make
raefb247 rbdfc032 1 2 3 1 CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS) 4 2 LTCFACOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ … … 21 19 $(am__mv) $$depbase.Tpo $$depbase.Plo 22 20 23 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@)24 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@)25 am__v_JAVAC_0 = @echo " JAVAC " $@;26 am__v_JAVAC_1 =27 28 AM_V_GOC = $(am__v_GOC_@AM_V@)29 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@)30 am__v_GOC_0 = @echo " GOC " $@;31 am__v_GOC_1 =32 33 21 UPPCC = u++ 34 22 UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS) … … 38 26 am__v_UPP_0 = @echo " UPP " $@; 39 27 am__v_UPP_1 = 28 29 AM_V_GOC = $(am__v_GOC_@AM_V@) 30 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@) 31 am__v_GOC_0 = @echo " GOC " $@; 32 am__v_GOC_1 = 33 34 AM_V_RUST = $(am__v_RUST_@AM_V@) 35 am__v_RUST_ = $(am__v_RUST_@AM_DEFAULT_V@) 36 am__v_RUST_0 = @echo " RUST " $@; 37 am__v_RUST_1 = 38 39 AM_V_NODEJS = $(am__v_NODEJS_@AM_V@) 40 am__v_NODEJS_ = $(am__v_NODEJS_@AM_DEFAULT_V@) 41 am__v_NODEJS_0 = @echo " NODEJS " $@; 42 am__v_NODEJS_1 = 43 44 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@) 45 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@) 46 am__v_JAVAC_0 = @echo " JAVAC " $@; 47 am__v_JAVAC_1 =
Note:
See TracChangeset
for help on using the changeset viewer.