Changes in / [66f8528:596f987b]
- Location:
- src
- Files:
-
- 8 deleted
- 63 edited
-
CodeGen/CodeGenerator.cc (modified) (3 diffs)
-
CodeGen/CodeGenerator.h (modified) (2 diffs)
-
GenPoly/Box.cc (modified) (34 diffs)
-
GenPoly/CopyParams.cc (modified) (2 diffs)
-
GenPoly/GenPoly.cc (modified) (5 diffs)
-
GenPoly/GenPoly.h (modified) (6 diffs)
-
GenPoly/InstantiateGeneric.cc (modified) (2 diffs)
-
GenPoly/PolyMutator.cc (modified) (3 diffs)
-
GenPoly/PolyMutator.h (modified) (1 diff)
-
GenPoly/ScrubTyVars.cc (modified) (3 diffs)
-
InitTweak/FixInit.cc (modified) (23 diffs)
-
InitTweak/GenInit.cc (modified) (6 diffs)
-
ResolvExpr/AdjustExprType.cc (modified) (1 diff)
-
ResolvExpr/AlternativeFinder.cc (modified) (14 diffs)
-
ResolvExpr/AlternativeFinder.h (modified) (2 diffs)
-
ResolvExpr/CommonType.cc (modified) (3 diffs)
-
ResolvExpr/FindOpenVars.cc (modified) (2 diffs)
-
ResolvExpr/PtrsCastable.cc (modified) (3 diffs)
-
ResolvExpr/Resolver.cc (modified) (15 diffs)
-
ResolvExpr/Resolver.h (modified) (1 diff)
-
ResolvExpr/TypeEnvironment.cc (modified) (5 diffs)
-
ResolvExpr/TypeEnvironment.h (modified) (2 diffs)
-
ResolvExpr/Unify.cc (modified) (10 diffs)
-
ResolvExpr/Unify.h (modified) (2 diffs)
-
SymTab/Autogen.cc (modified) (19 diffs)
-
SymTab/Indexer.cc (modified) (2 diffs)
-
SymTab/Indexer.h (modified) (1 diff)
-
SymTab/Validate.cc (modified) (15 diffs)
-
SynTree/ApplicationExpr.cc (modified) (1 diff)
-
SynTree/CompoundStmt.cc (modified) (1 diff)
-
SynTree/Declaration.h (modified) (4 diffs)
-
SynTree/Expression.cc (modified) (7 diffs)
-
SynTree/Expression.h (modified) (5 diffs)
-
SynTree/Initializer.cc (modified) (1 diff)
-
SynTree/Initializer.h (modified) (1 diff)
-
SynTree/Mutator.cc (modified) (4 diffs)
-
SynTree/ReferenceToType.cc (modified) (4 diffs)
-
SynTree/TupleExpr.cc (modified) (1 diff)
-
SynTree/Type.h (modified) (3 diffs)
-
SynTree/TypeDecl.cc (modified) (3 diffs)
-
SynTree/VarExprReplacer.cc (modified) (1 diff)
-
SynTree/Visitor.cc (modified) (4 diffs)
-
Tuples/Explode.cc (modified) (2 diffs)
-
Tuples/TupleAssignment.cc (modified) (6 diffs)
-
Tuples/TupleExpansion.cc (modified) (7 diffs)
-
main.cc (modified) (2 diffs)
-
prelude/prelude.cf (modified) (1 diff)
-
tests/.expect/32/declarationSpecifier.txt (modified) (25 diffs)
-
tests/.expect/32/extension.txt (modified) (4 diffs)
-
tests/.expect/32/gccExtensions.txt (modified) (11 diffs)
-
tests/.expect/64/declarationSpecifier.txt (modified) (25 diffs)
-
tests/.expect/64/extension.txt (modified) (4 diffs)
-
tests/.expect/64/gccExtensions.txt (modified) (11 diffs)
-
tests/.expect/castError.txt (modified) (1 diff)
-
tests/.expect/completeTypeError.txt (deleted)
-
tests/.expect/memberCtors.txt (modified) (3 diffs)
-
tests/.expect/scopeErrors.txt (modified) (1 diff)
-
tests/.expect/simpleGenericTriple.txt (deleted)
-
tests/.expect/tupleCast.txt (deleted)
-
tests/.expect/tuplePolymorphism.txt (deleted)
-
tests/Makefile.am (modified) (1 diff)
-
tests/Makefile.in (modified) (1 diff)
-
tests/completeTypeError.c (deleted)
-
tests/memberCtors.c (modified) (2 diffs)
-
tests/shortCircuit.c (modified) (2 diffs)
-
tests/simpleGenericTriple.c (deleted)
-
tests/tupleAssign.c (modified) (2 diffs)
-
tests/tupleCast.c (deleted)
-
tests/tupleFunction.c (modified) (3 diffs)
-
tests/tupleMember.c (modified) (2 diffs)
-
tests/tuplePolymorphism.c (deleted)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r66f8528 r596f987b 179 179 output << aggDecl->get_name(); 180 180 181 //std::list< Declaration * > & memb = aggDecl->get_members();182 //if ( ! memb.empty() ) {183 if ( aggDecl->has_body() ) {184 std::list< Declaration * > & memb = aggDecl->get_members();181 std::list< Declaration * > & memb = aggDecl->get_members(); 182 if ( ! memb.empty() ) { 183 // if ( aggDecl->has_body() ) { 184 // std::list< Declaration * > & memb = aggDecl->get_members(); 185 185 output << " {" << endl; 186 186 … … 291 291 } // if 292 292 output << " }"; 293 }294 295 void CodeGenerator::visit( ConstructorInit * init ){296 assertf( false, "ConstructorInit nodes should not make it to CodeGen." );297 293 } 298 294 … … 921 917 } // switch 922 918 } 923 924 std::string genName( DeclarationWithType * decl ) {925 CodeGen::OperatorInfo opInfo;926 if ( operatorLookup( decl->get_name(), opInfo ) ) {927 return opInfo.outputName;928 } else {929 return decl->get_name();930 } // if931 }932 919 } // namespace CodeGen 933 920 -
src/CodeGen/CodeGenerator.h
r66f8528 r596f987b 47 47 virtual void visit( SingleInit * ); 48 48 virtual void visit( ListInit * ); 49 virtual void visit( ConstructorInit * );50 49 51 50 //*** Constant … … 145 144 return true; 146 145 } 147 148 /// returns C-compatible name of declaration149 std::string genName( DeclarationWithType * decl );150 146 } // namespace CodeGen 151 147 -
src/GenPoly/Box.cc
r66f8528 r596f987b 55 55 #include "Common/utility.h" 56 56 57 #include "InitTweak/InitTweak.h"58 59 57 #include <ext/functional> // temporary 60 58 … … 100 98 void passArgTypeVars( ApplicationExpr *appExpr, Type *parmType, Type *argBaseType, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars, std::set< std::string > &seenTypes ); 101 99 /// passes extra type parameters into a polymorphic function application 102 void passTypeVars( ApplicationExpr *appExpr, Type *polyRetType, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars );100 void passTypeVars( ApplicationExpr *appExpr, ReferenceToType *polyRetType, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ); 103 101 /// wraps a function application with a new temporary for the out-parameter return value 104 102 Expression *addRetParam( ApplicationExpr *appExpr, FunctionType *function, Type *retType, std::list< Expression *>::iterator &arg ); … … 109 107 Type *replaceWithConcrete( ApplicationExpr *appExpr, Type *type, bool doClone = true ); 110 108 /// wraps a function application returning a polymorphic type with a new temporary for the out-parameter return value 111 Expression *addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, Type *polyType, std::list< Expression *>::iterator &arg );109 Expression *addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg ); 112 110 Expression *applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ); 113 111 void boxParam( Type *formal, Expression *&arg, const TyVarMap &exprTyVars ); … … 115 113 void addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ); 116 114 /// Stores assignment operators from assertion list in local map of assignment operations 115 void findTypeOps( const Type::ForallList &forall ); 117 116 void passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars ); 118 117 FunctionDecl *makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars ); … … 122 121 ObjectDecl *makeTemporary( Type *type ); 123 122 123 ScopedMap< std::string, DeclarationWithType* > assignOps; ///< Currently known type variable assignment operators 124 ScopedMap< std::string, DeclarationWithType* > ctorOps; ///< Currently known type variable constructors 125 ScopedMap< std::string, DeclarationWithType* > copyOps; ///< Currently known type variable copy constructors 126 ScopedMap< std::string, DeclarationWithType* > dtorOps; ///< Currently known type variable destructors 127 ResolvExpr::TypeMap< DeclarationWithType > scopedAssignOps; ///< Currently known assignment operators 128 ResolvExpr::TypeMap< DeclarationWithType > scopedCtorOps; ///< Currently known assignment operators 129 ResolvExpr::TypeMap< DeclarationWithType > scopedCopyOps; ///< Currently known assignment operators 130 ResolvExpr::TypeMap< DeclarationWithType > scopedDtorOps; ///< Currently known assignment operators 124 131 ScopedMap< std::string, DeclarationWithType* > adapters; ///< Set of adapter functions in the current scope 125 132 126 std::map< ApplicationExpr *, Expression * > retVals;127 128 133 DeclarationWithType *retval; 134 bool useRetval; 129 135 UniqueName tempNamer; 130 136 }; … … 269 275 270 276 for ( std::list< TypeDecl* >::const_iterator decl = decls.begin(); decl != decls.end(); ++decl ) { 271 if ( (*decl)-> isComplete()) {277 if ( (*decl)->get_kind() == TypeDecl::Any ) { 272 278 otypeDecls.push_back( *decl ); 273 279 } … … 491 497 } 492 498 493 Pass1::Pass1() : tempNamer( "_temp" ) {} 499 Pass1::Pass1() : useRetval( false ), tempNamer( "_temp" ) {} 500 501 /// Returns T if the given declaration is a function with parameter (T*) for some TypeInstType T, NULL otherwise 502 TypeInstType *isTypeInstPtrFn( DeclarationWithType *decl ) { 503 if ( FunctionType *funType = getFunctionType( decl->get_type() ) ) { 504 if ( funType->get_parameters().size() == 1 ) { 505 if ( PointerType *pointer = dynamic_cast< PointerType *>( funType->get_parameters().front()->get_type() ) ) { 506 if ( TypeInstType *refType = dynamic_cast< TypeInstType *>( pointer->get_base() ) ) { 507 return refType; 508 } // if 509 } // if 510 } // if 511 } // if 512 return 0; 513 } 514 515 /// Returns T if the given declaration is a function with parameters (T*, T) for some TypeInstType T, NULL otherwise 516 TypeInstType *isTypeInstPtrValFn( DeclarationWithType *decl ) { 517 if ( FunctionType *funType = getFunctionType( decl->get_type() ) ) { 518 if ( funType->get_parameters().size() == 2 ) { 519 if ( PointerType *pointer = dynamic_cast< PointerType *>( funType->get_parameters().front()->get_type() ) ) { 520 if ( TypeInstType *refType = dynamic_cast< TypeInstType *>( pointer->get_base() ) ) { 521 if ( TypeInstType *refType2 = dynamic_cast< TypeInstType *>( funType->get_parameters().back()->get_type() ) ) { 522 if ( refType->get_name() == refType2->get_name() ) { 523 return refType; 524 } // if 525 } // if 526 } // if 527 } // if 528 } // if 529 } // if 530 return 0; 531 } 532 533 /// Returns T if the given declaration is (*?=?)(T *, T) for some TypeInstType T (return not checked, but maybe should be), NULL otherwise 534 TypeInstType *isTypeInstAssignment( DeclarationWithType *decl ) { 535 return decl->get_name() == "?=?" ? isTypeInstPtrValFn( decl ) : 0; 536 } 537 538 /// Returns T if the given declaration is (*?{})(T *) for some TypeInstType T (return not checked, but maybe should be), NULL otherwise 539 TypeInstType *isTypeInstCtor( DeclarationWithType *decl ) { 540 return decl->get_name() == "?{}" ? isTypeInstPtrFn( decl ) : 0; 541 } 542 543 /// Returns T if the given declaration is (*?{})(T *, T) for some TypeInstType T (return not checked, but maybe should be), NULL otherwise 544 TypeInstType *isTypeInstCopy( DeclarationWithType *decl ) { 545 return decl->get_name() == "?{}" ? isTypeInstPtrValFn( decl ) : 0; 546 } 547 548 /// Returns T if the given declaration is (*^?{})(T *) for some TypeInstType T (return not checked, but maybe should be), NULL otherwise 549 TypeInstType *isTypeInstDtor( DeclarationWithType *decl ) { 550 return decl->get_name() == "^?{}" ? isTypeInstPtrFn( decl ) : 0; 551 } 552 553 /// Returns T if the given declaration is a function with parameters (T*, T) for some type T, where neither parameter is cv-qualified, 554 /// NULL otherwise 555 Type *isNoCvPtrFn( DeclarationWithType *decl ) { 556 if ( FunctionType *funType = getFunctionType( decl->get_type() ) ) { 557 if ( funType->get_parameters().size() == 1 ) { 558 Type::Qualifiers defaultQualifiers; 559 Type *paramType = funType->get_parameters().front()->get_type(); 560 if ( paramType->get_qualifiers() != defaultQualifiers ) return 0; 561 562 if ( PointerType *pointerType = dynamic_cast< PointerType* >( paramType ) ) { 563 Type *baseType = pointerType->get_base(); 564 if ( baseType->get_qualifiers() == defaultQualifiers ) { 565 return baseType; 566 } // if 567 } // if 568 } // if 569 } // if 570 return 0; 571 } 572 573 /// Returns T if the given declaration is a function with parameters (T*, T) for some type T, where neither parameter is cv-qualified, 574 /// NULL otherwise 575 Type *isNoCvPtrValFn( DeclarationWithType *decl ) { 576 if ( FunctionType *funType = getFunctionType( decl->get_type() ) ) { 577 if ( funType->get_parameters().size() == 2 ) { 578 Type::Qualifiers defaultQualifiers; 579 Type *paramType1 = funType->get_parameters().front()->get_type(); 580 if ( paramType1->get_qualifiers() != defaultQualifiers ) return 0; 581 Type *paramType2 = funType->get_parameters().back()->get_type(); 582 if ( paramType2->get_qualifiers() != defaultQualifiers ) return 0; 583 584 if ( PointerType *pointerType = dynamic_cast< PointerType* >( paramType1 ) ) { 585 Type *baseType1 = pointerType->get_base(); 586 if ( baseType1->get_qualifiers() != defaultQualifiers ) return 0; 587 SymTab::Indexer dummy; 588 if ( ResolvExpr::typesCompatible( baseType1, paramType2, dummy ) ) { 589 return baseType1; 590 } // if 591 } // if 592 } // if 593 } // if 594 return 0; 595 } 596 597 /// returns T if the given declaration is: (*?=?)(T *, T) for some type T (return not checked, but maybe should be), NULL otherwise 598 /// Only picks assignments where neither parameter is cv-qualified 599 Type *isAssignment( DeclarationWithType *decl ) { 600 return decl->get_name() == "?=?" ? isNoCvPtrValFn( decl ) : 0; 601 } 602 603 /// returns T if the given declaration is: (*?{})(T *) for some type T, NULL otherwise 604 /// Only picks ctors where the parameter is not cv-qualified 605 Type *isCtor( DeclarationWithType *decl ) { 606 return decl->get_name() == "?{}" ? isNoCvPtrFn( decl ) : 0; 607 } 608 609 /// returns T if the given declaration is: (*?{})(T *, T) for some type T (return not checked, but maybe should be), NULL otherwise 610 /// Only picks copy constructors where neither parameter is cv-qualified 611 Type *isCopy( DeclarationWithType *decl ) { 612 return decl->get_name() == "?{}" ? isNoCvPtrValFn( decl ) : 0; 613 } 614 615 /// returns T if the given declaration is: (*?{})(T *) for some type T, NULL otherwise 616 /// Only picks ctors where the parameter is not cv-qualified 617 Type *isDtor( DeclarationWithType *decl ) { 618 return decl->get_name() == "^?{}" ? isNoCvPtrFn( decl ) : 0; 619 } 620 621 void Pass1::findTypeOps( const Type::ForallList &forall ) { 622 // what if a nested function uses an assignment operator? 623 // assignOps.clear(); 624 for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) { 625 for ( std::list< DeclarationWithType *>::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) { 626 std::string typeName; 627 if ( TypeInstType *typeInst = isTypeInstAssignment( *assert ) ) { 628 assignOps[ typeInst->get_name() ] = *assert; 629 } else if ( TypeInstType *typeInst = isTypeInstCtor( *assert ) ) { 630 ctorOps[ typeInst->get_name() ] = *assert; 631 } else if ( TypeInstType *typeInst = isTypeInstCopy( *assert ) ) { 632 copyOps[ typeInst->get_name() ] = *assert; 633 } else if ( TypeInstType *typeInst = isTypeInstDtor( *assert ) ) { 634 dtorOps[ typeInst->get_name() ] = *assert; 635 } // if 636 } // for 637 } // for 638 } 494 639 495 640 DeclarationWithType *Pass1::mutate( FunctionDecl *functionDecl ) { 641 // if this is a assignment function, put it in the map for this scope 642 if ( Type *paramType = isAssignment( functionDecl ) ) { 643 if ( ! dynamic_cast< TypeInstType* >( paramType ) ) { 644 scopedAssignOps.insert( paramType, functionDecl ); 645 } 646 } else if ( Type *paramType = isCtor( functionDecl ) ) { 647 if ( ! dynamic_cast< TypeInstType* >( paramType ) ) { 648 scopedCtorOps.insert( paramType, functionDecl ); 649 } 650 } else if ( Type *paramType = isCopy( functionDecl ) ) { 651 if ( ! dynamic_cast< TypeInstType* >( paramType ) ) { 652 scopedCopyOps.insert( paramType, functionDecl ); 653 } 654 } else if ( Type *paramType = isDtor( functionDecl ) ) { 655 if ( ! dynamic_cast< TypeInstType* >( paramType ) ) { 656 scopedDtorOps.insert( paramType, functionDecl ); 657 } 658 } 659 496 660 if ( functionDecl->get_statements() ) { // empty routine body ? 497 661 doBeginScope(); 498 662 scopeTyVars.beginScope(); 663 assignOps.beginScope(); 664 ctorOps.beginScope(); 665 copyOps.beginScope(); 666 dtorOps.beginScope(); 499 667 500 668 DeclarationWithType *oldRetval = retval; 669 bool oldUseRetval = useRetval; 501 670 502 671 // process polymorphic return value 503 retval = nullptr;504 if ( isDynRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() != LinkageSpec::C) {672 retval = 0; 673 if ( isDynRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) { 505 674 retval = functionDecl->get_functionType()->get_returnVals().front(); 506 675 … … 514 683 FunctionType *functionType = functionDecl->get_functionType(); 515 684 makeTyVarMap( functionDecl->get_functionType(), scopeTyVars ); 685 findTypeOps( functionDecl->get_functionType()->get_forall() ); 516 686 517 687 std::list< DeclarationWithType *> ¶mList = functionType->get_parameters(); … … 530 700 if ( adapters.find( mangleName ) == adapters.end() ) { 531 701 std::string adapterName = makeAdapterName( mangleName ); 532 adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, new ObjectDecl( adapterName, DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), nullptr) ) );702 adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, new ObjectDecl( adapterName, DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), 0 ) ) ); 533 703 } // if 534 704 } // for … … 537 707 538 708 scopeTyVars.endScope(); 709 assignOps.endScope(); 710 ctorOps.endScope(); 711 copyOps.endScope(); 712 dtorOps.endScope(); 539 713 retval = oldRetval; 714 useRetval = oldUseRetval; 540 715 doEndScope(); 541 716 } // if … … 544 719 545 720 TypeDecl *Pass1::mutate( TypeDecl *typeDecl ) { 546 addToTyVarMap( typeDecl, scopeTyVars);721 scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind(); 547 722 return Mutator::mutate( typeDecl ); 548 723 } 549 724 550 725 Expression *Pass1::mutate( CommaExpr *commaExpr ) { 551 // Attempting to find application expressions that were mutated by the copy constructor passes 552 // to use an explicit return variable, so that the variable can be reused as a parameter to the 553 // call rather than creating a new temp variable. Previously this step was an optimization, but 554 // with the introduction of tuples and UniqueExprs, it is necessary to ensure that they use the same variable. 555 // Essentially, looking for pattern: (x=f(...), x) 556 // To compound the issue, the right side can be *x, etc. because of lvalue-returning functions 557 if ( UntypedExpr * assign = dynamic_cast< UntypedExpr * >( commaExpr->get_arg1() ) ) { 558 if ( InitTweak::isAssignment( InitTweak::getFunctionName( assign ) ) ) { 559 assert( assign->get_args().size() == 2 ); 560 if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * > ( assign->get_args().back() ) ) { 561 // first argument is assignable, so it must be an lvalue, so it should be legal to take its address. 562 retVals[appExpr] = assign->get_args().front(); 563 } 564 } 565 } 566 726 bool oldUseRetval = useRetval; 727 useRetval = false; 567 728 commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) ); 729 useRetval = oldUseRetval; 568 730 commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) ); 569 731 return commaExpr; … … 571 733 572 734 Expression *Pass1::mutate( ConditionalExpr *condExpr ) { 735 bool oldUseRetval = useRetval; 736 useRetval = false; 573 737 condExpr->set_arg1( maybeMutate( condExpr->get_arg1(), *this ) ); 738 useRetval = oldUseRetval; 574 739 condExpr->set_arg2( maybeMutate( condExpr->get_arg2(), *this ) ); 575 740 condExpr->set_arg3( maybeMutate( condExpr->get_arg3(), *this ) ); … … 604 769 } 605 770 606 void Pass1::passTypeVars( ApplicationExpr *appExpr, Type *polyRetType, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ) {771 void Pass1::passTypeVars( ApplicationExpr *appExpr, ReferenceToType *polyRetType, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ) { 607 772 // pass size/align for type variables 608 773 for ( TyVarMap::const_iterator tyParm = exprTyVars.begin(); tyParm != exprTyVars.end(); ++tyParm ) { 609 774 ResolvExpr::EqvClass eqvClass; 610 775 assert( env ); 611 if ( tyParm->second .isComplete) {776 if ( tyParm->second == TypeDecl::Any ) { 612 777 Type *concrete = env->lookup( tyParm->first ); 613 778 if ( concrete ) { … … 618 783 } else { 619 784 // xxx - should this be an assertion? 620 std::string x = env ? toString( *env ) : "missing env"; 621 throw SemanticError( x + "\n" + "unbound type variable: " + tyParm->first + " in application ", appExpr ); 785 throw SemanticError( "unbound type variable: " + tyParm->first + " in application ", appExpr ); 622 786 } // if 623 787 } // if … … 637 801 Type *concRetType = replaceWithConcrete( appExpr, polyRetType ); 638 802 passArgTypeVars( appExpr, polyRetType, concRetType, arg, exprTyVars, seenTypes ); 639 ++fnArg; // skip the return parameter in the argument list640 803 } 641 804 642 805 // add type information args for presently unseen types in parameter list 643 806 for ( ; fnParm != funcType->get_parameters().end() && fnArg != appExpr->get_args().end(); ++fnParm, ++fnArg ) { 644 if ( ! (*fnArg)->get_result() ) continue;645 Type * argType = (*fnArg)->get_result();646 passArgTypeVars( appExpr, (*fnParm)->get_type(), argType, arg, exprTyVars, seenTypes );807 VariableExpr *fnArgBase = getBaseVar( *fnArg ); 808 if ( ! fnArgBase ) continue; // xxx - previously had check for non-empty fnArgBase results 809 passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_result(), arg, exprTyVars, seenTypes ); 647 810 } 648 811 } … … 655 818 656 819 Expression *Pass1::addRetParam( ApplicationExpr *appExpr, FunctionType *function, Type *retType, std::list< Expression *>::iterator &arg ) { 820 // ***** Code Removal ***** After introducing a temporary variable for all return expressions, the following code appears superfluous. 821 // if ( useRetval ) { 822 // assert( retval ); 823 // arg = appExpr->get_args().insert( arg, new VariableExpr( retval ) ); 824 // arg++; 825 // } else { 826 657 827 // Create temporary to hold return value of polymorphic function and produce that temporary as a result 658 // using a comma expression. 659 assert( retType ); 660 661 Expression * paramExpr = nullptr; 662 // try to use existing return value parameter if it exists, otherwise create a new temporary 663 if ( retVals.count( appExpr ) ) { 664 paramExpr = retVals[appExpr]->clone(); 665 } else { 666 ObjectDecl *newObj = makeTemporary( retType->clone() ); 667 paramExpr = new VariableExpr( newObj ); 668 } 669 Expression * retExpr = paramExpr->clone(); 828 // using a comma expression. Possibly change comma expression into statement expression "{}" for multiple 829 // return values. 830 ObjectDecl *newObj = makeTemporary( retType->clone() ); 831 Expression *paramExpr = new VariableExpr( newObj ); 670 832 671 833 // If the type of the temporary is not polymorphic, box temporary by taking its address; 672 834 // otherwise the temporary is already boxed and can be used directly. 673 if ( ! isPolyType( paramExpr->get_result(), scopeTyVars, env ) ) {835 if ( ! isPolyType( newObj->get_type(), scopeTyVars, env ) ) { 674 836 paramExpr = new AddressExpr( paramExpr ); 675 837 } // if … … 677 839 arg++; 678 840 // Build a comma expression to call the function and emulate a normal return. 679 CommaExpr *commaExpr = new CommaExpr( appExpr, retExpr);841 CommaExpr *commaExpr = new CommaExpr( appExpr, new VariableExpr( newObj ) ); 680 842 commaExpr->set_env( appExpr->get_env() ); 681 843 appExpr->set_env( 0 ); 682 844 return commaExpr; 845 // } // if 846 // return appExpr; 683 847 } 684 848 … … 695 859 Type *concrete = env->lookup( typeInst->get_name() ); 696 860 if ( concrete == 0 ) { 697 // xxx - should this be an assertion? 698 std::string x = env ? toString( *env ) : "missing env"; 699 throw SemanticError( x + "\n" + "Unbound type variable " + typeInst->get_name() + " in ", appExpr ); 861 throw SemanticError( "Unbound type variable " + typeInst->get_name() + " in ", appExpr ); 700 862 } // if 701 863 return concrete; … … 716 878 } 717 879 718 Expression *Pass1::addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, Type *dynType, std::list< Expression *>::iterator &arg ) {880 Expression *Pass1::addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *dynType, std::list< Expression *>::iterator &arg ) { 719 881 assert( env ); 720 882 Type *concrete = replaceWithConcrete( appExpr, dynType ); … … 794 956 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) { 795 957 InferredParams::const_iterator inferParam = appExpr->get_inferParams().find( (*assert)->get_uniqueId() ); 796 if ( inferParam == appExpr->get_inferParams().end() ) { 797 std::cerr << "looking for assertion: " << (*assert) << std::endl << appExpr << std::endl; 798 } 799 assertf( inferParam != appExpr->get_inferParams().end(), "NOTE: Explicit casts of polymorphic functions to compatible monomorphic functions are currently unsupported" ); 958 assert( inferParam != appExpr->get_inferParams().end() && "NOTE: Explicit casts of polymorphic functions to compatible monomorphic functions are currently unsupported" ); 800 959 Expression *newExpr = inferParam->second.expr->clone(); 801 960 addCast( newExpr, (*assert)->get_type(), tyVars ); … … 1108 1267 // } 1109 1268 // std::cerr << "\n"; 1269 bool oldUseRetval = useRetval; 1270 useRetval = false; 1110 1271 appExpr->get_function()->acceptMutator( *this ); 1111 1272 mutateAll( appExpr->get_args(), *this ); 1273 useRetval = oldUseRetval; 1112 1274 1113 1275 assert( appExpr->get_function()->has_result() ); … … 1124 1286 std::list< Expression *>::iterator paramBegin = appExpr->get_args().begin(); 1125 1287 1126 TyVarMap exprTyVars( TypeDecl::Data{});1127 makeTyVarMap( function, exprTyVars ); // xxx - should this take into account the variables already bound in scopeTyVars (i.e. remove them from exprTyVars?)1288 TyVarMap exprTyVars( (TypeDecl::Kind)-1 ); 1289 makeTyVarMap( function, exprTyVars ); 1128 1290 ReferenceToType *dynRetType = isDynRet( function, exprTyVars ); 1129 Type *concRetType = appExpr->get_result()->isVoid() ? nullptr : appExpr->get_result();// ?: dynRetType; // xxx - is concRetType a good name?1130 1291 1131 1292 if ( dynRetType ) { 1132 ret = addDynRetParam( appExpr, function, concRetType, arg ); // xxx - used to use dynRetType instead of concRetType 1133 } else if ( needsAdapter( function, scopeTyVars ) && ! needsAdapter( function, exprTyVars) ) { // xxx - exprTyVars is used above...? 1134 // xxx - the ! needsAdapter check may be incorrect. It seems there is some situation where an adapter is applied where it shouldn't be, and this fixes it for some cases. More investigation is needed. 1135 1293 ret = addDynRetParam( appExpr, function, dynRetType, arg ); 1294 } else if ( needsAdapter( function, scopeTyVars ) ) { 1136 1295 // std::cerr << "needs adapter: "; 1137 1296 // printTyVarMap( std::cerr, scopeTyVars ); … … 1142 1301 arg = appExpr->get_args().begin(); 1143 1302 1144 passTypeVars( appExpr, concRetType, arg, exprTyVars ); // xxx - used to use dynRetType instead of concRetType; this changed so that the correct type paramaters are passed for return types (it should be the concrete type's parameters, not the formal type's)1303 passTypeVars( appExpr, dynRetType, arg, exprTyVars ); 1145 1304 addInferredParams( appExpr, function, arg, exprTyVars ); 1146 1305 … … 1201 1360 } 1202 1361 1362 /// Wraps a function declaration in a new pointer-to-function variable expression 1363 VariableExpr *wrapFunctionDecl( DeclarationWithType *functionDecl ) { 1364 // line below cloned from FixFunction.cc 1365 // xxx - functionObj is never added to a list of declarations... 1366 ObjectDecl *functionObj = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClass(), functionDecl->get_linkage(), 0, 1367 new PointerType( Type::Qualifiers(), functionDecl->get_type()->clone() ), 0 ); 1368 functionObj->set_mangleName( functionDecl->get_mangleName() ); 1369 functionObj->set_scopeLevel( functionDecl->get_scopeLevel() ); 1370 return new VariableExpr( functionObj ); 1371 } 1372 1373 /// Finds the operation declaration for a given type in one of the two maps 1374 DeclarationWithType* findOpForType( Type *formalType, const ScopedMap< std::string, DeclarationWithType* >& ops, ResolvExpr::TypeMap< DeclarationWithType >& scopedOps ) { 1375 if ( TypeInstType *formalTypeInstType = dynamic_cast< TypeInstType* >( formalType ) ) { 1376 ScopedMap< std::string, DeclarationWithType *>::const_iterator opIt = ops.find( formalTypeInstType->get_name() ); 1377 return opIt == ops.end() ? 0 : opIt->second; 1378 } else { 1379 return scopedOps.find( formalType ); 1380 } 1381 } 1382 1383 /// Adds an assertion parameter to the application expression for the actual assertion declaration valued with the assert op 1384 void addAssertionFor( ApplicationExpr *appExpr, DeclarationWithType *actualDecl, DeclarationWithType *assertOp ) { 1385 appExpr->get_inferParams()[ actualDecl->get_uniqueId() ] 1386 = ParamEntry( assertOp->get_uniqueId(), assertOp->get_type()->clone(), actualDecl->get_type()->clone(), wrapFunctionDecl( assertOp ) ); 1387 } 1388 1203 1389 Statement * Pass1::mutate( ReturnStmt *returnStmt ) { 1204 // maybe need access to the env when mutating the expr1205 if ( Expression * expr = returnStmt->get_expr() ) {1206 if ( expr->get_env() ) {1207 env = expr->get_env();1208 }1209 }1210 1211 1390 if ( retval && returnStmt->get_expr() ) { 1212 1391 assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() ); 1213 delete returnStmt->get_expr(); 1392 // ***** Code Removal ***** After introducing a temporary variable for all return expressions, the following code appears superfluous. 1393 // if ( returnStmt->get_expr()->get_results().front()->get_isLvalue() ) { 1394 // by this point, a cast expr on a polymorphic return value is redundant 1395 while ( CastExpr *castExpr = dynamic_cast< CastExpr *>( returnStmt->get_expr() ) ) { 1396 returnStmt->set_expr( castExpr->get_arg() ); 1397 returnStmt->get_expr()->set_env( castExpr->get_env() ); 1398 castExpr->set_env( 0 ); 1399 castExpr->set_arg( 0 ); 1400 delete castExpr; 1401 } //while 1402 1403 // find assignment operator for (polymorphic) return type 1404 ApplicationExpr *assignExpr = 0; 1405 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( retval->get_type() ) ) { 1406 // find assignment operator for type variable 1407 ScopedMap< std::string, DeclarationWithType *>::const_iterator assignIter = assignOps.find( typeInst->get_name() ); 1408 if ( assignIter == assignOps.end() ) { 1409 throw SemanticError( "Attempt to return dtype or ftype object in ", returnStmt->get_expr() ); 1410 } // if 1411 assignExpr = new ApplicationExpr( new VariableExpr( assignIter->second ) ); 1412 } else if ( ReferenceToType *refType = dynamic_cast< ReferenceToType *>( retval->get_type() ) ) { 1413 // find assignment operator for generic type 1414 DeclarationWithType *functionDecl = scopedAssignOps.find( refType ); 1415 if ( ! functionDecl ) { 1416 throw SemanticError( "Attempt to return dtype or ftype generic object in ", returnStmt->get_expr() ); 1417 } 1418 1419 // wrap it up in an application expression 1420 assignExpr = new ApplicationExpr( wrapFunctionDecl( functionDecl ) ); 1421 assignExpr->set_env( env->clone() ); 1422 1423 // find each of its needed secondary assignment operators 1424 std::list< Expression* > &tyParams = refType->get_parameters(); 1425 Type::ForallList &forallParams = functionDecl->get_type()->get_forall(); 1426 std::list< Expression* >::const_iterator tyIt = tyParams.begin(); 1427 Type::ForallList::const_iterator forallIt = forallParams.begin(); 1428 for ( ; tyIt != tyParams.end() && forallIt != forallParams.end(); ++tyIt, ++forallIt ) { 1429 // Add appropriate mapping to assignment expression environment 1430 TypeExpr *formalTypeExpr = dynamic_cast< TypeExpr* >( *tyIt ); 1431 assert( formalTypeExpr && "type parameters must be type expressions" ); 1432 Type *formalType = formalTypeExpr->get_type(); 1433 assignExpr->get_env()->add( (*forallIt)->get_name(), formalType ); 1434 1435 // skip non-otype parameters (ftype/dtype) 1436 if ( (*forallIt)->get_kind() != TypeDecl::Any ) continue; 1437 1438 // find otype operators for formal type 1439 DeclarationWithType *assertAssign = findOpForType( formalType, assignOps, scopedAssignOps ); 1440 if ( ! assertAssign ) throw SemanticError( "No assignment operation found for ", formalType ); 1441 1442 DeclarationWithType *assertCtor = findOpForType( formalType, ctorOps, scopedCtorOps ); 1443 if ( ! assertCtor ) throw SemanticError( "No default constructor found for ", formalType ); 1444 1445 DeclarationWithType *assertCopy = findOpForType( formalType, copyOps, scopedCopyOps ); 1446 if ( ! assertCopy ) throw SemanticError( "No copy constructor found for ", formalType ); 1447 1448 DeclarationWithType *assertDtor = findOpForType( formalType, dtorOps, scopedDtorOps ); 1449 if ( ! assertDtor ) throw SemanticError( "No destructor found for ", formalType ); 1450 1451 // add inferred parameters for otype operators to assignment expression 1452 // NOTE: Code here assumes that first four assertions are assign op, ctor, copy ctor, dtor, in that order 1453 std::list< DeclarationWithType* > &asserts = (*forallIt)->get_assertions(); 1454 assert( asserts.size() >= 4 && "Type param needs otype operator assertions" ); 1455 1456 std::list< DeclarationWithType* >::iterator actualIt = asserts.begin(); 1457 addAssertionFor( assignExpr, *actualIt, assertAssign ); 1458 ++actualIt; 1459 addAssertionFor( assignExpr, *actualIt, assertCtor ); 1460 ++actualIt; 1461 addAssertionFor( assignExpr, *actualIt, assertCopy ); 1462 ++actualIt; 1463 addAssertionFor( assignExpr, *actualIt, assertDtor ); 1464 1465 } 1466 } 1467 assert( assignExpr ); 1468 1469 // replace return statement with appropriate assignment to out parameter 1470 Expression *retParm = new NameExpr( retval->get_name() ); 1471 retParm->set_result( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) ); 1472 assignExpr->get_args().push_back( retParm ); 1473 assignExpr->get_args().push_back( returnStmt->get_expr() ); 1474 stmtsToAdd.push_back( new ExprStmt( noLabels, mutateExpression( assignExpr ) ) ); 1475 // } else { 1476 // useRetval = true; 1477 // stmtsToAdd.push_back( new ExprStmt( noLabels, mutateExpression( returnStmt->get_expr() ) ) ); 1478 // useRetval = false; 1479 // } // if 1214 1480 returnStmt->set_expr( 0 ); 1215 1481 } else { … … 1241 1507 void Pass1::doBeginScope() { 1242 1508 adapters.beginScope(); 1509 scopedAssignOps.beginScope(); 1510 scopedCtorOps.beginScope(); 1511 scopedCopyOps.beginScope(); 1512 scopedDtorOps.beginScope(); 1243 1513 } 1244 1514 1245 1515 void Pass1::doEndScope() { 1246 1516 adapters.endScope(); 1517 scopedAssignOps.endScope(); 1518 scopedCtorOps.endScope(); 1519 scopedCopyOps.endScope(); 1520 scopedDtorOps.endScope(); 1247 1521 } 1248 1522 … … 1276 1550 } 1277 1551 1278 /// determines if `pref` is a prefix of `str`1279 bool isPrefix( const std::string & str, const std::string & pref ) {1280 if ( pref.size() > str.size() ) return false;1281 auto its = std::mismatch( pref.begin(), pref.end(), str.begin() );1282 return its.first == pref.end();1283 }1284 1285 1552 DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) { 1286 functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl, functionDecl->get_functionType() ) ); 1287 FunctionType * ftype = functionDecl->get_functionType(); 1288 if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) { 1289 if ( functionDecl->get_name() != "?=?" && ! isPrefix( functionDecl->get_name(), "_thunk" ) ) { // xxx - remove check for ?=? once reference types are in; remove check for prefix once thunks properly use ctor/dtors 1290 assert( ftype->get_returnVals().size() == 1 ); 1291 DeclarationWithType * retval = ftype->get_returnVals().front(); 1292 if ( retval->get_name() == "" ) { 1293 retval->set_name( "_retval" ); 1294 } 1295 functionDecl->get_statements()->get_kids().push_front( new DeclStmt( noLabels, retval ) ); 1296 DeclarationWithType * newRet = retval->clone(); // for ownership purposes 1297 ftype->get_returnVals().front() = newRet; 1298 } 1299 } 1300 return functionDecl; 1553 return handleDecl( functionDecl, functionDecl->get_functionType() ); 1301 1554 } 1302 1555 … … 1306 1559 1307 1560 TypeDecl * Pass2::mutate( TypeDecl *typeDecl ) { 1308 addToTyVarMap( typeDecl, scopeTyVars);1561 scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind(); 1309 1562 if ( typeDecl->get_base() ) { 1310 1563 return handleDecl( typeDecl, typeDecl->get_base() ); … … 1334 1587 // move polymorphic return type to parameter list 1335 1588 if ( isDynRet( funcType ) ) { 1336 ObjectDecl *ret = safe_dynamic_cast< ObjectDecl* >( funcType->get_returnVals().front());1589 DeclarationWithType *ret = funcType->get_returnVals().front(); 1337 1590 ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) ); 1338 1591 funcType->get_parameters().push_front( ret ); 1339 1592 funcType->get_returnVals().pop_front(); 1340 ret->set_init( nullptr ); // xxx - memory leak?1341 1593 } 1342 1594 … … 1350 1602 ObjectDecl *sizeParm, *alignParm; 1351 1603 // add all size and alignment parameters to parameter list 1352 if ( (*tyParm)-> isComplete()) {1604 if ( (*tyParm)->get_kind() == TypeDecl::Any ) { 1353 1605 TypeInstType parmType( Type::Qualifiers(), (*tyParm)->get_name(), *tyParm ); 1354 1606 std::string parmName = mangleType( &parmType ); … … 1459 1711 1460 1712 TypeDecl * PolyGenericCalculator::mutate( TypeDecl *typeDecl ) { 1461 addToTyVarMap( typeDecl, scopeTyVars);1713 scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind(); 1462 1714 return Parent::mutate( typeDecl ); 1463 1715 } … … 1573 1825 // replace member expression with pointer to base plus offset 1574 1826 UntypedExpr *fieldLoc = new UntypedExpr( new NameExpr( "?+?" ) ); 1575 Expression * aggr = memberExpr->get_aggregate()->clone(); 1576 delete aggr->get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it 1577 aggr->set_env( nullptr ); 1578 fieldLoc->get_args().push_back( aggr ); 1827 fieldLoc->get_args().push_back( makeDerefdVar( varExpr->clone(), varDepth ) ); 1579 1828 fieldLoc->get_args().push_back( makeOffsetIndex( objectType, i ) ); 1580 1829 newMemberExpr = fieldLoc; … … 1626 1875 for ( ; baseParam != baseParams.end() && typeParam != typeParams.end(); ++baseParam, ++typeParam ) { 1627 1876 // skip non-otype parameters 1628 if ( ! (*baseParam)->isComplete()) continue;1877 if ( (*baseParam)->get_kind() != TypeDecl::Any ) continue; 1629 1878 TypeExpr *typeExpr = dynamic_cast< TypeExpr* >( *typeParam ); 1630 1879 assert( typeExpr && "all otype parameters should be type expressions" ); … … 1838 2087 // Initializer *init = 0; 1839 2088 // std::list< Expression *> designators; 1840 // addToTyVarMap( typeDecl, scopeTyVars);2089 // scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind(); 1841 2090 // if ( typeDecl->get_base() ) { 1842 2091 // init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators ); … … 1844 2093 // return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init ); 1845 2094 1846 addToTyVarMap( typeDecl, scopeTyVars);2095 scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind(); 1847 2096 return Mutator::mutate( typeDecl ); 1848 2097 } -
src/GenPoly/CopyParams.cc
r66f8528 r596f987b 38 38 }; 39 39 40 /// creates local copies of polymorphic function parameters41 40 void copyParams( std::list< Declaration* > &translationUnit ) { 42 41 CopyParams copier; … … 54 53 if ( ! modVars.empty() ) { 55 54 std::map< std::string, DeclarationWithType* > assignOps; 56 // xxx - this needs to use constructors, not assignment operators57 55 // assume the assignment operator is the first assert param after any "type" parameter 58 56 for ( Type::ForallList::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) { -
src/GenPoly/GenPoly.cc
r66f8528 r596f987b 92 92 } 93 93 94 ReferenceToType *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {94 Type *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) { 95 95 type = replaceTypeInst( type, env ); 96 96 97 97 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) { 98 98 auto var = tyVars.find( typeInst->get_name() ); 99 if ( var != tyVars.end() && var->second .isComplete) {100 return type Inst;99 if ( var != tyVars.end() && var->second == TypeDecl::Any ) { 100 return type; 101 101 } 102 102 } else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) { 103 if ( hasDynParams( structType->get_parameters(), tyVars, env ) ) return structType;103 if ( hasDynParams( structType->get_parameters(), tyVars, env ) ) return type; 104 104 } else if ( UnionInstType *unionType = dynamic_cast< UnionInstType* >( type ) ) { 105 if ( hasDynParams( unionType->get_parameters(), tyVars, env ) ) return unionType;105 if ( hasDynParams( unionType->get_parameters(), tyVars, env ) ) return type; 106 106 } 107 107 return 0; … … 117 117 if ( function->get_returnVals().empty() ) return 0; 118 118 119 TyVarMap forallTypes( TypeDecl::Data{});119 TyVarMap forallTypes( (TypeDecl::Kind)-1 ); 120 120 makeTyVarMap( function, forallTypes ); 121 121 return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes ); … … 219 219 expr = commaExpr->get_arg2(); 220 220 continue; 221 } else if ( ConditionalExpr * condExpr = dynamic_cast< ConditionalExpr * >( expr ) ) {222 int lvl1;223 int lvl2;224 VariableExpr * var1 = getBaseVar( condExpr->get_arg2(), &lvl1 );225 VariableExpr * var2 = getBaseVar( condExpr->get_arg3(), &lvl2 );226 if ( lvl1 == lvl2 && var1 && var2 && var1->get_var() == var2->get_var() ) {227 *levels = lvl1;228 return var1;229 }230 break;231 221 } else break; 232 222 … … 235 225 236 226 return 0; 237 }238 239 void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap ) {240 tyVarMap[ tyVar->get_name() ] = TypeDecl::Data{ tyVar };241 227 } 242 228 … … 244 230 for ( Type::ForallList::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) { 245 231 assert( *tyVar ); 246 addToTyVarMap( *tyVar, tyVarMap);232 tyVarMap[ (*tyVar)->get_name() ] = (*tyVar)->get_kind(); 247 233 } 248 234 if ( PointerType *pointer = dynamic_cast< PointerType* >( type ) ) { -
src/GenPoly/GenPoly.h
r66f8528 r596f987b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // GenPoly.h -- 7 // GenPoly.h -- 8 8 // 9 9 // Author : Richard C. Bilson … … 30 30 31 31 namespace GenPoly { 32 typedef ErasableScopedMap< std::string, TypeDecl:: Data> TyVarMap;32 typedef ErasableScopedMap< std::string, TypeDecl::Kind > TyVarMap; 33 33 34 34 /// Replaces a TypeInstType by its referrent in the environment, if applicable 35 35 Type* replaceTypeInst( Type* type, const TypeSubstitution* env ); 36 36 37 37 /// returns polymorphic type if is polymorphic type, NULL otherwise; will look up substitution in env if provided 38 38 Type *isPolyType( Type *type, const TypeSubstitution *env = 0 ); 39 39 40 40 /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided 41 41 Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 42 42 43 43 /// returns dynamic-layout type if is dynamic-layout type in tyVars, NULL otherwise; will look up substitution in env if provided 44 ReferenceToType *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );44 Type *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 45 45 46 46 /// true iff function has dynamic-layout return type under the given type variable map … … 55 55 /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided 56 56 Type *isPolyPtr( Type *type, const TypeSubstitution *env = 0 ); 57 57 58 58 /// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided 59 59 Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); … … 74 74 VariableExpr *getBaseVar( Expression *expr, int *levels = 0 ); 75 75 76 /// Adds the type variable `tyVar` to `tyVarMap`77 void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap );78 79 76 /// Adds the declarations in the forall list of type (and its pointed-to type if it's a pointer type) to `tyVarMap` 80 77 void makeTyVarMap( Type *type, TyVarMap &tyVarMap ); 81 78 82 79 /// Prints type variable map 83 80 void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap ); … … 85 82 /// Gets the mangled name of this type; alias for SymTab::Mangler::mangleType(). 86 83 inline std::string mangleType( Type *ty ) { return SymTab::Mangler::mangleType( ty ); } 87 84 88 85 /// Gets the name of the sizeof parameter for the type, given its mangled name 89 86 inline std::string sizeofName( const std::string &name ) { return std::string( "_sizeof_" ) + name; } … … 97 94 /// Gets the name of the layout function for a given aggregate type, given its declaration 98 95 inline std::string layoutofName( AggregateDecl *decl ) { return std::string( "_layoutof_" ) + decl->get_name(); } 99 96 100 97 } // namespace GenPoly 101 98 -
src/GenPoly/InstantiateGeneric.cc
r66f8528 r596f987b 284 284 // set concDecl to new type, insert type declaration into statements to add 285 285 concDecl = new StructDecl( typeNamer.newName( inst->get_name() ) ); 286 concDecl->set_body( inst->get_baseStruct()->has_body() );287 286 substituteMembers( inst->get_baseStruct()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() ); 288 287 DeclMutator::addDeclaration( concDecl ); … … 338 337 // set concDecl to new type, insert type declaration into statements to add 339 338 concDecl = new UnionDecl( typeNamer.newName( inst->get_name() ) ); 340 concDecl->set_body( inst->get_baseUnion()->has_body() );341 339 substituteMembers( inst->get_baseUnion()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() ); 342 340 DeclMutator::addDeclaration( concDecl ); -
src/GenPoly/PolyMutator.cc
r66f8528 r596f987b 23 23 24 24 namespace GenPoly { 25 PolyMutator::PolyMutator() : scopeTyVars( TypeDecl::Data{} ), env( 0 ) {} 25 namespace { 26 const std::list<Label> noLabels; 27 } 28 29 PolyMutator::PolyMutator() : scopeTyVars( (TypeDecl::Kind)-1 ), env( 0 ) {} 26 30 27 31 void PolyMutator::mutateStatementList( std::list< Statement* > &statements ) { … … 145 149 } 146 150 147 Expression *PolyMutator::mutate( StmtExpr * stmtExpr ) {148 // don't want statements from outer CompoundStmts to be added to this StmtExpr149 ValueGuard< std::list< Statement* > > oldStmtsToAdd( stmtsToAdd );150 ValueGuard< std::list< Statement* > > oldStmtsToAddAfter( stmtsToAddAfter );151 ValueGuard< TypeSubstitution * > oldEnv( env );152 153 // xxx - not sure if this is needed, along with appropriate reset, but I don't think so...154 // ValueGuard< TyVarMap > oldScopeTyVars( scopeTyVars );155 156 stmtsToAdd.clear();157 stmtsToAddAfter.clear();158 // scopeTyVars.clear();159 160 return Parent::mutate( stmtExpr );161 }162 151 163 152 Initializer *PolyMutator::mutate( SingleInit *singleInit ) { … … 165 154 return singleInit; 166 155 } 156 167 157 } // namespace GenPoly 168 158 -
src/GenPoly/PolyMutator.h
r66f8528 r596f987b 47 47 48 48 virtual Expression* mutate(UntypedExpr *untypedExpr); 49 virtual Expression* mutate( StmtExpr *stmtExpr );50 49 51 50 virtual Initializer* mutate(SingleInit *SingleInit); -
src/GenPoly/ScrubTyVars.cc
r66f8528 r596f987b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ScrubTyVars.cc -- 7 // ScrubTyVars.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 28 28 TyVarMap::const_iterator tyVar = tyVars.find( typeInst->get_name() ); 29 29 if ( tyVar != tyVars.end() ) { 30 switch ( tyVar->second .kind) {30 switch ( tyVar->second ) { 31 31 case TypeDecl::Any: 32 32 case TypeDecl::Dtype: … … 52 52 return ty; 53 53 } 54 54 55 55 Type * ScrubTyVars::mutate( StructInstType *structInst ) { 56 56 return mutateAggregateType( structInst ); -
src/InitTweak/FixInit.cc
r66f8528 r596f987b 49 49 namespace InitTweak { 50 50 namespace { 51 typedef std::unordered_map< Expression *, TypeSubstitution * > EnvMap;52 53 51 class InsertImplicitCalls final : public GenPoly::PolyMutator { 54 52 public: 55 53 /// wrap function application expressions as ImplicitCopyCtorExpr nodes so that it is easy to identify which 56 54 /// function calls need their parameters to be copy constructed 57 static void insert( std::list< Declaration * > & translationUnit, EnvMap & envMap ); 58 59 InsertImplicitCalls( EnvMap & envMap ) : envMap( envMap ) {} 60 typedef GenPoly::PolyMutator Parent; 61 using Parent::mutate; 55 static void insert( std::list< Declaration * > & translationUnit ); 56 57 using GenPoly::PolyMutator::mutate; 62 58 virtual Expression * mutate( ApplicationExpr * appExpr ) override; 63 virtual Expression * mutate( StmtExpr * stmtExpr ) override;64 65 // collects environments for relevant nodes66 EnvMap & envMap;67 59 }; 68 60 … … 72 64 /// generate/resolve copy construction expressions for each, and generate/resolve destructors for both 73 65 /// arguments and return value temporaries 74 static void resolveImplicitCalls( std::list< Declaration * > & translationUnit , const EnvMap & envMap);66 static void resolveImplicitCalls( std::list< Declaration * > & translationUnit ); 75 67 76 68 typedef SymTab::Indexer Parent; 77 69 using Parent::visit; 78 70 79 ResolveCopyCtors( const EnvMap & envMap ) : envMap( envMap ) {}80 81 71 virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr ) override; 82 virtual void visit( UniqueExpr * unqExpr ) override; 83 virtual void visit( StmtExpr * stmtExpr ) override; 72 virtual void visit( UniqueExpr * unqExpr ); 84 73 85 74 /// create and resolve ctor/dtor expression: fname(var, [cpArg]) … … 90 79 void copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr ); 91 80 void destructRet( Expression * ret, ImplicitCopyCtorExpr * impCpCtorExpr ); 92 81 private: 93 82 TypeSubstitution * env; 94 const EnvMap & envMap;95 83 }; 96 84 … … 186 174 static void fixInitializers( std::list< Declaration * > &translationUnit ); 187 175 188 typedef GenPoly::PolyMutator Parent; 189 using Parent::mutate; 176 using GenPoly::PolyMutator::mutate; 190 177 virtual DeclarationWithType * mutate( ObjectDecl *objDecl ) override; 191 178 … … 199 186 static void fixCopyCtors( std::list< Declaration * > &translationUnit ); 200 187 201 typedef GenPoly::PolyMutator Parent; 202 using Parent::mutate; 188 using GenPoly::PolyMutator::mutate; 203 189 virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) override; 204 190 virtual Expression * mutate( UniqueExpr * unqExpr ) override; 205 virtual Expression * mutate( StmtExpr * stmtExpr ) override;206 191 }; 207 192 … … 263 248 InitTweak::fixGlobalInit( translationUnit, filename, inLibrary ); 264 249 265 EnvMap envMap; 266 267 InsertImplicitCalls::insert( translationUnit, envMap ); 268 ResolveCopyCtors::resolveImplicitCalls( translationUnit, envMap ); 250 251 InsertImplicitCalls::insert( translationUnit ); 252 ResolveCopyCtors::resolveImplicitCalls( translationUnit ); 269 253 InsertDtors::insert( translationUnit ); 270 254 FixInit::fixInitializers( translationUnit ); … … 285 269 286 270 namespace { 287 void InsertImplicitCalls::insert( std::list< Declaration * > & translationUnit , EnvMap & envMap) {288 InsertImplicitCalls inserter ( envMap );271 void InsertImplicitCalls::insert( std::list< Declaration * > & translationUnit ) { 272 InsertImplicitCalls inserter; 289 273 mutateAll( translationUnit, inserter ); 290 274 } 291 275 292 void ResolveCopyCtors::resolveImplicitCalls( std::list< Declaration * > & translationUnit , const EnvMap & envMap) {293 ResolveCopyCtors resolver ( envMap );276 void ResolveCopyCtors::resolveImplicitCalls( std::list< Declaration * > & translationUnit ) { 277 ResolveCopyCtors resolver; 294 278 acceptAll( translationUnit, resolver ); 295 279 } … … 342 326 343 327 Expression * InsertImplicitCalls::mutate( ApplicationExpr * appExpr ) { 344 appExpr = dynamic_cast< ApplicationExpr * >( Parent::mutate( appExpr ) );328 appExpr = dynamic_cast< ApplicationExpr * >( Mutator::mutate( appExpr ) ); 345 329 assert( appExpr ); 346 330 … … 355 339 Type * t1 = ftype->get_parameters().front()->get_type(); 356 340 Type * t2 = ftype->get_parameters().back()->get_type(); 357 PointerType * ptrType = safe_dynamic_cast< PointerType * > ( t1 ); 341 PointerType * ptrType = dynamic_cast< PointerType * > ( t1 ); 342 assert( ptrType ); 358 343 359 344 if ( ResolvExpr::typesCompatible( ptrType->get_base(), t2, SymTab::Indexer() ) ) { … … 372 357 // wrap each function call so that it is easy to identify nodes that have to be copy constructed 373 358 ImplicitCopyCtorExpr * expr = new ImplicitCopyCtorExpr( appExpr ); 374 // save the type substitution into the envMapso that it is easy to find.359 // save the type substitution onto the new node so that it is easy to find. 375 360 // Ensure it is not deleted with the ImplicitCopyCtorExpr by removing it before deletion. 376 361 // The substitution is needed to obtain the type of temporary variables so that copy constructor … … 381 366 // constructor calls together. 382 367 assert( env ); 383 e nvMap[expr] = env;368 expr->set_env( env ); 384 369 return expr; 385 }386 387 Expression * InsertImplicitCalls::mutate( StmtExpr * stmtExpr ) {388 assert( env );389 envMap[stmtExpr] = env;390 return Parent::mutate( stmtExpr );391 370 } 392 371 … … 413 392 assert( resolved ); 414 393 if ( resolved->get_env() ) { 415 // Extract useful information and discard new environments. Keeping them causes problems in PolyMutator passes.416 394 env->add( *resolved->get_env() ); 417 delete resolved->get_env();418 resolved->set_env( nullptr );419 395 } // if 420 396 … … 425 401 void ResolveCopyCtors::copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr ) { 426 402 static UniqueName tempNamer("_tmp_cp"); 427 assert( env ); 428 CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *env << std::endl; ) 403 CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; ) 429 404 assert( arg->has_result() ); 430 405 Type * result = arg->get_result(); … … 433 408 // type may involve type variables, so apply type substitution to get temporary variable's actual type 434 409 result = result->clone(); 435 env->apply( result );410 impCpCtorExpr->get_env()->apply( result ); 436 411 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 ); 437 412 tmp->get_type()->set_isConst( false ); … … 462 437 CP_CTOR_PRINT( std::cerr << "ResolveCopyCtors: " << impCpCtorExpr << std::endl; ) 463 438 Parent::visit( impCpCtorExpr ); 464 env = envMap.at(impCpCtorExpr); 465 assert( env ); 439 env = impCpCtorExpr->get_env(); // xxx - maybe we really should just have a PolyIndexer... 466 440 467 441 ApplicationExpr * appExpr = impCpCtorExpr->get_callExpr(); … … 474 448 // each return value from the call needs to be connected with an ObjectDecl at the call site, which is 475 449 // initialized with the return value and is destructed later 476 // xxx - handle named return values? 450 // xxx - handle multiple return values 451 ApplicationExpr * callExpr = impCpCtorExpr->get_callExpr(); 452 // xxx - is this right? callExpr may not have the right environment, because it was attached at a higher 453 // level. Trying to pass that environment along. 454 callExpr->set_env( impCpCtorExpr->get_env()->clone() ); 477 455 Type * result = appExpr->get_result(); 478 456 if ( ! result->isVoid() ) { 479 457 static UniqueName retNamer("_tmp_cp_ret"); 480 458 result = result->clone(); 481 env->apply( result );459 impCpCtorExpr->get_env()->apply( result ); 482 460 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 ); 483 461 ret->get_type()->set_isConst( false ); … … 490 468 } // for 491 469 CP_CTOR_PRINT( std::cerr << "after Resolving: " << impCpCtorExpr << std::endl; ) 492 }493 494 void ResolveCopyCtors::visit( StmtExpr * stmtExpr ) {495 Parent::visit( stmtExpr );496 env = envMap.at(stmtExpr);497 assert( stmtExpr->get_result() );498 Type * result = stmtExpr->get_result();499 if ( ! result->isVoid() ) {500 static UniqueName retNamer("_tmp_stmtexpr_ret");501 502 // create variable that will hold the result of the stmt expr503 result = result->clone();504 env->apply( result );505 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 );506 ret->get_type()->set_isConst( false );507 stmtExpr->get_returnDecls().push_front( ret );508 509 // must have a non-empty body, otherwise it wouldn't have a result510 CompoundStmt * body = stmtExpr->get_statements();511 assert( ! body->get_kids().empty() );512 // must be an ExprStmt, otherwise it wouldn't have a result513 ExprStmt * last = safe_dynamic_cast< ExprStmt * >( body->get_kids().back() );514 last->set_expr( makeCtorDtor( "?{}", ret, last->get_expr() ) );515 516 stmtExpr->get_dtors().push_front( makeCtorDtor( "^?{}", new AddressExpr( new VariableExpr( ret ) ) ) );517 } // if518 519 470 } 520 471 … … 541 492 } 542 493 494 543 495 Expression * FixCopyCtors::mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) { 544 496 CP_CTOR_PRINT( std::cerr << "FixCopyCtors: " << impCpCtorExpr << std::endl; ) 545 497 546 impCpCtorExpr = safe_dynamic_cast< ImplicitCopyCtorExpr * >( Parent::mutate( impCpCtorExpr ) ); 498 impCpCtorExpr = dynamic_cast< ImplicitCopyCtorExpr * >( Mutator::mutate( impCpCtorExpr ) ); 499 assert( impCpCtorExpr ); 500 547 501 std::list< ObjectDecl * > & tempDecls = impCpCtorExpr->get_tempDecls(); 548 502 std::list< ObjectDecl * > & returnDecls = impCpCtorExpr->get_returnDecls(); … … 604 558 retExpr = UntypedExpr::createDeref( retExpr ); 605 559 } // if 606 // move env from callExpr to retExpr 607 retExpr->set_env( callExpr->get_env() ); 608 callExpr->set_env( nullptr ); 560 retExpr->set_env( env->clone() ); 609 561 return retExpr; 610 562 } else { … … 613 565 } 614 566 615 Expression * FixCopyCtors::mutate( StmtExpr * stmtExpr ) {616 stmtExpr = safe_dynamic_cast< StmtExpr * >( Parent::mutate( stmtExpr ) );617 assert( stmtExpr->get_result() );618 Type * result = stmtExpr->get_result();619 if ( ! result->isVoid() ) {620 for ( ObjectDecl * obj : stmtExpr->get_returnDecls() ) {621 stmtsToAdd.push_back( new DeclStmt( noLabels, obj ) );622 } // for623 // add destructors after current statement624 for ( Expression * dtor : stmtExpr->get_dtors() ) {625 stmtsToAddAfter.push_back( new ExprStmt( noLabels, dtor ) );626 } // for627 // must have a non-empty body, otherwise it wouldn't have a result628 CompoundStmt * body = stmtExpr->get_statements();629 assert( ! body->get_kids().empty() );630 assert( ! stmtExpr->get_returnDecls().empty() );631 body->get_kids().push_back( new ExprStmt( noLabels, new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );632 }633 stmtExpr->get_returnDecls().clear();634 stmtExpr->get_dtors().clear();635 return stmtExpr;636 }637 638 567 Expression * FixCopyCtors::mutate( UniqueExpr * unqExpr ) { 639 568 static std::unordered_map< int, UniqueExpr * > unqMap; 640 569 static std::unordered_set< int > addDeref; 641 570 // has to be done to clean up ImplicitCopyCtorExpr nodes, even when this node was skipped in previous passes 571 unqExpr = safe_dynamic_cast< UniqueExpr * >( Parent::mutate( unqExpr ) ); 642 572 if ( unqMap.count( unqExpr->get_id() ) ) { 643 573 // take data from other UniqueExpr to ensure consistency … … 652 582 return unqExpr; 653 583 } 654 unqExpr = safe_dynamic_cast< UniqueExpr * >( Parent::mutate( unqExpr ) ); // stmtexprs contained should not be separately fixed, so this must occur after the lookup655 584 unqMap[unqExpr->get_id()] = unqExpr; 656 585 if ( UntypedExpr * deref = dynamic_cast< UntypedExpr * >( unqExpr->get_expr() ) ) { … … 670 599 // first recursively handle pieces of ObjectDecl so that they aren't missed by other visitors when the init 671 600 // is removed from the ObjectDecl 672 objDecl = dynamic_cast< ObjectDecl * >( Parent::mutate( objDecl ) ); 601 objDecl = dynamic_cast< ObjectDecl * >( Mutator::mutate( objDecl ) ); 602 673 603 if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) { 674 604 // a decision should have been made by the resolver, so ctor and init are not both non-NULL … … 974 904 // insert and resolve default/copy constructor call for each field that's unhandled 975 905 std::list< Statement * > stmt; 976 UntypedExpr * deref = UntypedExpr::createDeref( new VariableExpr( thisParam ) ); 906 UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) ); 907 deref->get_args().push_back( new VariableExpr( thisParam ) ); 977 908 978 909 Expression * arg2 = 0; -
src/InitTweak/GenInit.cc
r66f8528 r596f987b 46 46 ReturnFixer(); 47 47 48 typedef GenPoly::PolyMutator Parent; 49 using Parent::mutate; 48 using GenPoly::PolyMutator::mutate; 50 49 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override; 51 50 virtual Statement * mutate( ReturnStmt * returnStmt ) override; … … 53 52 protected: 54 53 FunctionType * ftype; 54 UniqueName tempNamer; 55 55 std::string funcName; 56 56 }; … … 135 135 } 136 136 137 ReturnFixer::ReturnFixer() {}137 ReturnFixer::ReturnFixer() : tempNamer( "_retVal" ) {} 138 138 139 139 Statement *ReturnFixer::mutate( ReturnStmt *returnStmt ) { … … 142 142 // hands off if the function returns an lvalue - we don't want to allocate a temporary if a variable's address 143 143 // is being returned 144 // Note: under the assumption that assignments return *this, checking for ?=? here is an optimization, since it shouldn't be necessary to copy construct `this`. This is a temporary optimization until reference types are added, at which point this should be removed, along with the analogous optimization in copy constructor generation.145 144 if ( returnStmt->get_expr() && returnVals.size() == 1 && funcName != "?=?" && ! returnVals.front()->get_type()->get_isLvalue() ) { 146 // explicitly construct the return value using the return expression and the retVal object 147 assertf( returnVals.front()->get_name() != "", "Function %s has unnamed return value\n", funcName.c_str() ); 145 // ensure return value is not destructed by explicitly creating 146 // an empty SingleInit node wherein maybeConstruct is false 147 ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, returnVals.front()->get_type()->clone(), new ListInit( std::list<Initializer*>(), noDesignators, false ) ); 148 stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) ); 149 150 // and explicitly create the constructor expression separately 148 151 UntypedExpr *construct = new UntypedExpr( new NameExpr( "?{}" ) ); 149 construct->get_args().push_back( new AddressExpr( new VariableExpr( returnVals.front()) ) );152 construct->get_args().push_back( new AddressExpr( new VariableExpr( newObj ) ) ); 150 153 construct->get_args().push_back( returnStmt->get_expr() ); 151 154 stmtsToAdd.push_back(new ExprStmt(noLabels, construct)); 152 155 153 // return the retVal object 154 returnStmt->set_expr( new VariableExpr( returnVals.front() ) ); 156 returnStmt->set_expr( new VariableExpr( newObj ) ); 155 157 } // if 156 158 return returnStmt; … … 158 160 159 161 DeclarationWithType* ReturnFixer::mutate( FunctionDecl *functionDecl ) { 162 // xxx - need to handle named return values - this pass may need to happen 163 // after resolution? the ordering is tricky because return statements must be 164 // constructed - the simplest way to do that (while also handling multiple 165 // returns) is to structure the returnVals into a tuple, as done here. 166 // however, if the tuple return value is structured before resolution, 167 // it's difficult to resolve named return values, since the name is lost 168 // in conversion to a tuple. this might be easiest to deal with 169 // after reference types are added, as it may then be possible to 170 // uniformly move named return values to the parameter list directly 160 171 ValueGuard< FunctionType * > oldFtype( ftype ); 161 172 ValueGuard< std::string > oldFuncName( funcName ); 162 173 163 174 ftype = functionDecl->get_functionType(); 175 std::list< DeclarationWithType * > & retVals = ftype->get_returnVals(); 176 if ( retVals.size() > 1 ) { 177 TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) ); 178 ObjectDecl * newRet = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) ); 179 retVals.clear(); 180 retVals.push_back( newRet ); 181 } 164 182 funcName = functionDecl->get_name(); 165 return Parent::mutate( functionDecl ); 183 DeclarationWithType * decl = Mutator::mutate( functionDecl ); 184 return decl; 166 185 } 167 186 … … 227 246 } 228 247 } 229 // a type is managed if it appears in the map of known managed types, or if it contains any polymorphism (is a type variable or generic type containing a type variable) 230 return managedTypes.find( SymTab::Mangler::mangle( type ) ) != managedTypes.end() || GenPoly::isPolyType( type ); 248 return managedTypes.find( SymTab::Mangler::mangle( type ) ) != managedTypes.end(); 231 249 } 232 250 -
src/ResolvExpr/AdjustExprType.cc
r66f8528 r596f987b 97 97 EqvClass eqvClass; 98 98 if ( env.lookup( typeInst->get_name(), eqvClass ) ) { 99 if ( eqvClass. data.kind == TypeDecl::Ftype ) {99 if ( eqvClass.kind == TypeDecl::Ftype ) { 100 100 PointerType *pointerType = new PointerType( Type::Qualifiers(), typeInst ); 101 101 return pointerType; -
src/ResolvExpr/AlternativeFinder.cc
r66f8528 r596f987b 44 44 #include "InitTweak/GenInit.h" 45 45 #include "ResolveTypeof.h" 46 #include "Resolver.h"47 46 48 47 extern bool resolvep; … … 186 185 if ( alternatives.begin() == oldBegin ) { 187 186 std::ostringstream stream; 188 stream << "Can't choose between " << alternatives.size() << "alternatives for expression ";187 stream << "Can't choose between alternatives for expression "; 189 188 expr->print( stream ); 190 189 stream << "Alternatives are:"; … … 309 308 (*actualType)->print( std::cerr, 8 ); 310 309 std::cerr << std::endl << " to "; 311 (*formal Type)->print( std::cerr, 8 );310 (*formal)->get_type()->print( std::cerr, 8 ); 312 311 ) 313 312 Cost newCost = conversionCost( *actualType, *formalType, indexer, alt.env ); … … 374 373 void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions ) { 375 374 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) { 376 unifiableVars[ (*tyvar)->get_name() ] = TypeDecl::Data{ *tyvar };375 unifiableVars[ (*tyvar)->get_name() ] = (*tyvar)->get_kind(); 377 376 for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->get_assertions().begin(); assert != (*tyvar)->get_assertions().end(); ++assert ) { 378 377 needAssertions[ *assert ] = true; … … 512 511 if ( ! cur->second ) { 513 512 inferRecursive( begin, end, newAlt, openVars, decls, newNeed, /*needParents,*/ level, indexer, out ); 514 return; // xxx - should this continue? previously this wasn't here, and it looks like it should be515 513 } 516 514 DeclarationWithType *curDecl = cur->first; 517 518 515 PRINT( 519 516 std::cerr << "inferRecursive: assertion is "; … … 609 606 makeUnifiableVars( funcType, openVars, resultNeed ); 610 607 AltList instantiatedActuals; // filled by instantiate function 611 if ( targetType && ! targetType->isVoid() ) {612 // attempt to narrow based on expected target type613 Type * returnType = funcType->get_returnVals().front()->get_type();614 if ( ! unify( returnType, targetType, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {615 // unification failed, don't pursue this alternative616 return;617 }618 }619 620 608 if ( instantiateFunction( funcType->get_parameters(), actualAlt, funcType->get_isVarArgs(), openVars, resultEnv, resultNeed, resultHave, instantiatedActuals ) ) { 621 609 ApplicationExpr *appExpr = new ApplicationExpr( func.expr->clone() ); … … 661 649 AltList candidates; 662 650 SemanticError errors; 651 663 652 for ( AltList::const_iterator func = funcFinder.alternatives.begin(); func != funcFinder.alternatives.end(); ++func ) { 664 653 try { … … 750 739 751 740 findMinCost( candidates.begin(), candidates.end(), std::back_inserter( alternatives ) ); 752 753 if ( alternatives.empty() && targetType && ! targetType->isVoid() ) {754 // xxx - this is a temporary hack. If resolution is unsuccessful with a target type, try again without a755 // target type, since it will sometimes succeed when it wouldn't easily with target type binding. For example,756 // forall( otype T ) lvalue T ?[?]( T *, ptrdiff_t );757 // const char * x = "hello world";758 // unsigned char ch = x[0];759 // Fails with simple return type binding. First, T is bound to unsigned char, then (x: const char *) is unified760 // with unsigned char *, which fails because pointer base types must be unified exactly. The new resolver should761 // fix this issue in a more robust way.762 targetType = nullptr;763 visit( untypedExpr );764 }765 741 } 766 742 … … 782 758 void AlternativeFinder::visit( CastExpr *castExpr ) { 783 759 Type *& toType = castExpr->get_result(); 784 assert( toType );785 760 toType = resolveTypeof( toType, indexer ); 786 761 SymTab::validateType( toType, &indexer ); … … 788 763 789 764 AlternativeFinder finder( indexer, env ); 790 finder.targetType = toType;791 765 finder.findWithAdjustment( castExpr->get_arg() ); 792 766 … … 802 776 int discardedValues = (*i).expr->get_result()->size() - castExpr->get_result()->size(); 803 777 if ( discardedValues < 0 ) continue; 804 // xxx - may need to go into tuple types and extract relevant types and use unifyList. Note that currently, this does not 805 // allow casting a tuple to an atomic type (e.g. (int)([1, 2, 3])) 778 // xxx - may need to go into tuple types and extract relavent types and use unifyList 806 779 // unification run for side-effects 807 780 unify( castExpr->get_result(), (*i).expr->get_result(), i->env, needAssertions, haveAssertions, openVars, indexer ); … … 810 783 // count one safe conversion for each value that is thrown away 811 784 thisCost += Cost( 0, 0, discardedValues ); 812 813 Expression * argExpr = i->expr->clone(); 814 if ( argExpr->get_result()->size() > 1 && ! castExpr->get_result()->isVoid() ) { 815 // Argument expression is a tuple and the target type is not void. Cast each member of the tuple 816 // to its corresponding target type, producing the tuple of those cast expressions. If there are 817 // more components of the tuple than components in the target type, then excess components do not 818 // come out in the result expression (but UniqueExprs ensure that side effects will still be done). 819 if ( Tuples::maybeImpure( argExpr ) && ! dynamic_cast< UniqueExpr * >( argExpr ) ) { 820 // expressions which may contain side effects require a single unique instance of the expression. 821 argExpr = new UniqueExpr( argExpr ); 822 } 823 std::list< Expression * > componentExprs; 824 for ( unsigned int i = 0; i < castExpr->get_result()->size(); i++ ) { 825 // cast each component 826 TupleIndexExpr * idx = new TupleIndexExpr( argExpr->clone(), i ); 827 componentExprs.push_back( new CastExpr( idx, castExpr->get_result()->getComponent( i )->clone() ) ); 828 } 829 delete argExpr; 830 assert( componentExprs.size() > 0 ); 831 // produce the tuple of casts 832 candidates.push_back( Alternative( new TupleExpr( componentExprs ), i->env, i->cost, thisCost ) ); 833 } else { 834 // handle normally 835 candidates.push_back( Alternative( new CastExpr( argExpr->clone(), toType->clone() ), i->env, i->cost, thisCost ) ); 836 } 785 CastExpr *newExpr = castExpr->clone(); 786 newExpr->set_arg( i->expr->clone() ); 787 candidates.push_back( Alternative( newExpr, i->env, i->cost, thisCost ) ); 837 788 } // if 838 789 } // for … … 849 800 AlternativeFinder funcFinder( indexer, env ); 850 801 funcFinder.findWithAdjustment( memberExpr->get_aggregate() ); 802 851 803 for ( AltList::const_iterator agg = funcFinder.alternatives.begin(); agg != funcFinder.alternatives.end(); ++agg ) { 852 804 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_result() ) ) { … … 1123 1075 } 1124 1076 1125 void AlternativeFinder::visit( StmtExpr *stmtExpr ) {1126 StmtExpr * newStmtExpr = stmtExpr->clone();1127 ResolvExpr::resolveStmtExpr( newStmtExpr, indexer );1128 // xxx - this env is almost certainly wrong, and needs to somehow contain the combined environments from all of the statements in the stmtExpr...1129 alternatives.push_back( Alternative( newStmtExpr, env, Cost::zero ) );1130 }1131 1132 1077 } // namespace ResolvExpr 1133 1078 -
src/ResolvExpr/AlternativeFinder.h
r66f8528 r596f987b 70 70 virtual void visit( TupleAssignExpr *tupleExpr ); 71 71 virtual void visit( UniqueExpr *unqExpr ); 72 virtual void visit( StmtExpr *stmtExpr );73 72 /// Runs a new alternative finder on each element in [begin, end) 74 73 /// and writes each alternative finder to out. … … 92 91 AltList alternatives; 93 92 const TypeEnvironment &env; 94 Type * targetType = nullptr;95 93 }; // AlternativeFinder 96 94 -
src/ResolvExpr/CommonType.cc
r66f8528 r596f987b 58 58 Type *result = visitor.get_result(); 59 59 if ( ! result ) { 60 // this appears to be handling for opaque type declarations61 60 if ( widenSecond ) { 62 if ( TypeInstType *inst = dynamic_cast< TypeInstType* >( type2 ) ) { 63 if ( NamedTypeDecl *nt = indexer.lookupType( inst->get_name() ) ) { 64 TypeDecl *type = safe_dynamic_cast< TypeDecl* >( nt ); 61 TypeInstType *inst = dynamic_cast< TypeInstType* >( type2 ); 62 if ( inst ) { 63 NamedTypeDecl *nt = indexer.lookupType( inst->get_name() ); 64 if ( nt ) { 65 TypeDecl *type = dynamic_cast< TypeDecl* >( nt ); 66 assert( type ); 65 67 if ( type->get_base() ) { 66 68 Type::Qualifiers tq1 = type1->get_qualifiers(), tq2 = type2->get_qualifiers(); … … 156 158 result->get_qualifiers() += otherPointer->get_qualifiers(); 157 159 } 158 160 159 161 void CommonType::visit( PointerType *pointerType ) { 160 162 if ( PointerType *otherPointer = dynamic_cast< PointerType* >( type2 ) ) { … … 221 223 NamedTypeDecl *nt = indexer.lookupType( inst->get_name() ); 222 224 if ( nt ) { 223 TypeDecl *type = safe_dynamic_cast< TypeDecl* >( nt ); 225 TypeDecl *type = dynamic_cast< TypeDecl* >( nt ); 226 assert( type ); 224 227 if ( type->get_base() ) { 225 228 Type::Qualifiers tq1 = inst->get_qualifiers(), tq2 = type2->get_qualifiers(); -
src/ResolvExpr/FindOpenVars.cc
r66f8528 r596f987b 48 48 if ( nextIsOpen ) { 49 49 for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) { 50 openVars[ (*i)->get_name() ] = TypeDecl::Data{ (*i) };50 openVars[ (*i)->get_name() ] = (*i)->get_kind(); 51 51 for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) { 52 52 needAssertions[ *assert ] = false; … … 57 57 } else { 58 58 for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) { 59 closedVars[ (*i)->get_name() ] = TypeDecl::Data{ (*i) };59 closedVars[ (*i)->get_name() ] = (*i)->get_kind(); 60 60 for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) { 61 61 haveAssertions[ *assert ] = false; -
src/ResolvExpr/PtrsCastable.cc
r66f8528 r596f987b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // PtrsCastable.cc -- 7 // PtrsCastable.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 25 25 public: 26 26 PtrsCastable( Type *dest, const TypeEnvironment &env, const SymTab::Indexer &indexer ); 27 27 28 28 int get_result() const { return result; } 29 29 … … 61 61 } //if 62 62 } else if ( env.lookup( typeInst->get_name(), eqvClass ) ) { 63 if ( eqvClass. data.kind == TypeDecl::Ftype ) {63 if ( eqvClass.kind == TypeDecl::Ftype ) { 64 64 return -1; 65 65 } // if -
src/ResolvExpr/Resolver.cc
r66f8528 r596f987b 36 36 public: 37 37 Resolver() : SymTab::Indexer( false ) {} 38 Resolver( const SymTab:: Indexer & other ) : SymTab::Indexer( other ) { 39 if ( const Resolver * res = dynamic_cast< const Resolver * >( &other ) ) { 40 functionReturn = res->functionReturn; 41 initContext = res->initContext; 42 inEnumDecl = res->inEnumDecl; 43 } 44 } 45 46 typedef SymTab::Indexer Parent; 47 using Parent::visit; 38 39 using SymTab::Indexer::visit; 48 40 virtual void visit( FunctionDecl *functionDecl ) override; 49 41 virtual void visit( ObjectDecl *functionDecl ) override; … … 74 66 void handlePtrType( PtrType * type ); 75 67 76 void resolveAggrInit( ReferenceToType*, InitIterator &, InitIterator & );77 void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator & , TypeSubstitution sub);68 void resolveAggrInit( AggregateDecl *, InitIterator &, InitIterator & ); 69 void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator & ); 78 70 void fallbackInit( ConstructorInit * ctorInit ); 79 71 … … 200 192 initContext = new BasicType( Type::Qualifiers(), BasicType::SignedInt ); 201 193 } 202 Parent::visit( objectDecl );194 SymTab::Indexer::visit( objectDecl ); 203 195 if ( inEnumDecl && dynamic_cast< EnumInstType * >( initContext ) ) { 204 196 // delete newly created signed int type … … 220 212 void Resolver::visit( ArrayType * at ) { 221 213 handlePtrType( at ); 222 Parent::visit( at );214 Visitor::visit( at ); 223 215 } 224 216 225 217 void Resolver::visit( PointerType * pt ) { 226 218 handlePtrType( pt ); 227 Parent::visit( pt );219 Visitor::visit( pt ); 228 220 } 229 221 … … 233 225 typeDecl->set_base( new_type ); 234 226 } // if 235 Parent::visit( typeDecl );227 SymTab::Indexer::visit( typeDecl ); 236 228 } 237 229 … … 246 238 ValueGuard< Type * > oldFunctionReturn( functionReturn ); 247 239 functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() ); 248 Parent::visit( functionDecl );240 SymTab::Indexer::visit( functionDecl ); 249 241 } 250 242 251 243 void Resolver::visit( EnumDecl * enumDecl ) { 252 244 // in case we decide to allow nested enums 253 ValueGuard< bool > oldInEnumDecl( inEnumDecl );245 bool oldInEnumDecl = inEnumDecl; 254 246 inEnumDecl = true; 255 Parent::visit( enumDecl ); 247 SymTab::Indexer::visit( enumDecl ); 248 inEnumDecl = oldInEnumDecl; 256 249 } 257 250 258 251 void Resolver::visit( ExprStmt *exprStmt ) { 259 assertf( exprStmt->get_expr(), "ExprStmt has null Expression in resolver" ); 260 Expression *newExpr = findVoidExpression( exprStmt->get_expr(), *this ); 261 delete exprStmt->get_expr(); 262 exprStmt->set_expr( newExpr ); 252 if ( exprStmt->get_expr() ) { 253 Expression *newExpr = findVoidExpression( exprStmt->get_expr(), *this ); 254 delete exprStmt->get_expr(); 255 exprStmt->set_expr( newExpr ); 256 } // if 263 257 } 264 258 … … 283 277 delete ifStmt->get_condition(); 284 278 ifStmt->set_condition( newExpr ); 285 Parent::visit( ifStmt );279 Visitor::visit( ifStmt ); 286 280 } 287 281 … … 290 284 delete whileStmt->get_condition(); 291 285 whileStmt->set_condition( newExpr ); 292 Parent::visit( whileStmt );286 Visitor::visit( whileStmt ); 293 287 } 294 288 295 289 void Resolver::visit( ForStmt *forStmt ) { 296 Parent::visit( forStmt );290 SymTab::Indexer::visit( forStmt ); 297 291 298 292 if ( forStmt->get_condition() ) { … … 324 318 325 319 void Resolver::visit( CaseStmt *caseStmt ) { 326 Parent::visit( caseStmt );320 Visitor::visit( caseStmt ); 327 321 } 328 322 … … 402 396 } 403 397 404 template< typename AggrInst > 405 TypeSubstitution makeGenericSubstitutuion( AggrInst * inst ) { 406 assert( inst ); 407 assert( inst->get_baseParameters() ); 408 std::list< TypeDecl * > baseParams = *inst->get_baseParameters(); 409 std::list< Expression * > typeSubs = inst->get_parameters(); 410 TypeSubstitution subs( baseParams.begin(), baseParams.end(), typeSubs.begin() ); 411 return subs; 412 } 413 414 ReferenceToType * isStructOrUnion( Type * type ) { 415 if ( StructInstType * sit = dynamic_cast< StructInstType * >( type ) ) { 416 return sit; 417 } else if ( UnionInstType * uit = dynamic_cast< UnionInstType * >( type ) ) { 418 return uit; 419 } 420 return nullptr; 421 } 422 423 void Resolver::resolveSingleAggrInit( Declaration * dcl, InitIterator & init, InitIterator & initEnd, TypeSubstitution sub ) { 398 void Resolver::resolveSingleAggrInit( Declaration * dcl, InitIterator & init, InitIterator & initEnd ) { 424 399 DeclarationWithType * dt = dynamic_cast< DeclarationWithType * >( dcl ); 425 400 assert( dt ); 426 // need to substitute for generic types, so that casts are to concrete types 427 initContext = dt->get_type()->clone(); 428 sub.apply( initContext ); 429 401 initContext = dt->get_type(); 430 402 try { 431 403 if ( init == initEnd ) return; // stop when there are no more initializers … … 434 406 } catch( SemanticError & ) { 435 407 // need to delve deeper, if you can 436 if ( ReferenceToType * type = isStructOrUnion( initContext ) ) { 437 resolveAggrInit( type, init, initEnd ); 408 if ( StructInstType * sit = dynamic_cast< StructInstType * >( dt->get_type() ) ) { 409 resolveAggrInit( sit->get_baseStruct(), init, initEnd ); 410 } else if ( UnionInstType * uit = dynamic_cast< UnionInstType * >( dt->get_type() ) ) { 411 resolveAggrInit( uit->get_baseUnion(), init, initEnd ); 438 412 } else { 439 413 // member is not an aggregate type, so can't go any deeper … … 445 419 } 446 420 447 void Resolver::resolveAggrInit( ReferenceToType * inst, InitIterator & init, InitIterator & initEnd ) { 448 if ( StructInstType * sit = dynamic_cast< StructInstType * >( inst ) ) { 449 TypeSubstitution sub = makeGenericSubstitutuion( sit ); 450 StructDecl * st = sit->get_baseStruct(); 421 void Resolver::resolveAggrInit( AggregateDecl * aggr, InitIterator & init, InitIterator & initEnd ) { 422 if ( StructDecl * st = dynamic_cast< StructDecl * >( aggr ) ) { 451 423 // want to resolve each initializer to the members of the struct, 452 424 // but if there are more initializers than members we should stop 453 425 list< Declaration * >::iterator it = st->get_members().begin(); 454 426 for ( ; it != st->get_members().end(); ++it) { 455 resolveSingleAggrInit( *it, init, initEnd , sub);427 resolveSingleAggrInit( *it, init, initEnd ); 456 428 } 457 } else if ( UnionInstType * uit = dynamic_cast< UnionInstType * >( inst ) ) { 458 TypeSubstitution sub = makeGenericSubstitutuion( uit ); 459 UnionDecl * un = uit->get_baseUnion(); 429 } else if ( UnionDecl * un = dynamic_cast< UnionDecl * >( aggr ) ) { 460 430 // only resolve to the first member of a union 461 resolveSingleAggrInit( *un->get_members().begin(), init, initEnd , sub);431 resolveSingleAggrInit( *un->get_members().begin(), init, initEnd ); 462 432 } // if 463 433 } … … 479 449 (*iter++)->accept( *this ); 480 450 } 481 } else if ( ReferenceToType * type = isStructOrUnion( initContext ) ) { 482 resolveAggrInit( type, iter, end ); 451 } else if ( StructInstType * st = dynamic_cast< StructInstType * >( initContext ) ) { 452 resolveAggrInit( st->get_baseStruct(), iter, end ); 453 } else if ( UnionInstType * st = dynamic_cast< UnionInstType * >( initContext ) ) { 454 resolveAggrInit( st->get_baseUnion(), iter, end ); 483 455 } else if ( TypeInstType * tt = dynamic_cast< TypeInstType * >( initContext ) ) { 484 456 Type * base = tt->get_baseType()->get_base(); … … 489 461 } else { 490 462 // missing implementation type -- might be an unknown type variable, so try proceeding with the current init context 491 Parent::visit( listInit );463 Visitor::visit( listInit ); 492 464 } 493 465 } else { 494 466 assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext ) 495 || dynamic_cast< ZeroType * >( initContext ) || dynamic_cast< OneType * >( initContext ) || dynamic_cast < EnumInstType * > ( initContext ));467 || dynamic_cast< ZeroType * >( initContext ) || dynamic_cast< OneType * >( initContext ) ); 496 468 // basic types are handled here 497 Parent::visit( listInit );469 Visitor::visit( listInit ); 498 470 } 499 471 … … 561 533 } 562 534 563 // needs to be callable from outside the resolver, so this is a standalone function564 void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer ) {565 assert( ctorInit );566 Resolver resolver( indexer );567 ctorInit->accept( resolver );568 }569 570 void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer ) {571 assert( stmtExpr );572 Resolver resolver( indexer );573 stmtExpr->accept( resolver );574 }575 576 535 void Resolver::visit( ConstructorInit *ctorInit ) { 577 536 // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit -
src/ResolvExpr/Resolver.h
r66f8528 r596f987b 25 25 Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer ); 26 26 Expression *findVoidExpression( Expression *untyped, const SymTab::Indexer &indexer ); 27 void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer );28 void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer );29 27 } // namespace ResolvExpr 30 28 -
src/ResolvExpr/TypeEnvironment.cc
r66f8528 r596f987b 32 32 // 33 33 // I've seen a TU go from 54 minutes to 1 minute 34 seconds with the addition of this comparator. 34 bool AssertCompare::operator()( DeclarationWithType * d1, DeclarationWithType * d2 ) const{34 bool AssertCompare::operator()( DeclarationWithType * d1, DeclarationWithType * d2 ) { 35 35 // Objects are always less than functions 36 36 if ( ObjectDecl * objectDecl1 = dynamic_cast< ObjectDecl * >( d1 ) ) { … … 94 94 dest.type = maybeClone( src.type ); 95 95 dest.allowWidening = src.allowWidening; 96 dest. data = src.data;96 dest.kind = src.kind; 97 97 } 98 98 … … 162 162 EqvClass newClass; 163 163 newClass.vars.insert( (*i)->get_name() ); 164 newClass. data = TypeDecl::Data{ (*i) };164 newClass.kind = (*i)->get_kind(); 165 165 env.push_back( newClass ); 166 166 } // for … … 177 177 sub.add( *theVar, theClass->type ); 178 178 } else if ( theVar != theClass->vars.begin() ) { 179 TypeInstType *newTypeInst = new TypeInstType( Type::Qualifiers(), *theClass->vars.begin(), theClass-> data.kind == TypeDecl::Ftype );179 TypeInstType *newTypeInst = new TypeInstType( Type::Qualifiers(), *theClass->vars.begin(), theClass->kind == TypeDecl::Ftype ); 180 180 /// std::cout << " bound to variable " << *theClass->vars.begin() << std::endl; 181 181 sub.add( *theVar, newTypeInst ); … … 243 243 for ( std::list< EqvClass >::const_iterator eqvClass = env.begin(); eqvClass != env.end(); ++eqvClass ) { 244 244 for ( std::set< std::string >::const_iterator var = eqvClass->vars.begin(); var != eqvClass->vars.end(); ++var ) { 245 openVars[ *var ] = eqvClass-> data;245 openVars[ *var ] = eqvClass->kind; 246 246 } // for 247 247 } // for -
src/ResolvExpr/TypeEnvironment.h
r66f8528 r596f987b 29 29 namespace ResolvExpr { 30 30 struct AssertCompare { 31 bool operator()( DeclarationWithType * d1, DeclarationWithType * d2 ) const;31 bool operator()( DeclarationWithType * d1, DeclarationWithType * d2 ); 32 32 }; 33 33 typedef std::map< DeclarationWithType*, bool, AssertCompare > AssertionSet; 34 typedef std::map< std::string, TypeDecl:: Data> OpenVarSet;34 typedef std::map< std::string, TypeDecl::Kind > OpenVarSet; 35 35 36 36 void printAssertionSet( const AssertionSet &, std::ostream &, int indent = 0 ); … … 41 41 Type *type; 42 42 bool allowWidening; 43 TypeDecl:: Data data;43 TypeDecl::Kind kind; 44 44 45 45 void initialize( const EqvClass &src, EqvClass &dest ); -
src/ResolvExpr/Unify.cc
r66f8528 r596f987b 99 99 newFirst->get_qualifiers() = Type::Qualifiers(); 100 100 newSecond->get_qualifiers() = Type::Qualifiers(); 101 /// std::c err<< "first is ";102 /// first->print( std::c err);103 /// std::c err<< std::endl << "second is ";104 /// second->print( std::c err);105 /// std::c err<< std::endl << "newFirst is ";106 /// newFirst->print( std::c err);107 /// std::c err<< std::endl << "newSecond is ";108 /// newSecond->print( std::c err);109 /// std::c err<< std::endl;101 /// std::cout << "first is "; 102 /// first->print( std::cout ); 103 /// std::cout << std::endl << "second is "; 104 /// second->print( std::cout ); 105 /// std::cout << std::endl << "newFirst is "; 106 /// newFirst->print( std::cout ); 107 /// std::cout << std::endl << "newSecond is "; 108 /// newSecond->print( std::cout ); 109 /// std::cout << std::endl; 110 110 bool result = unifyExact( newFirst, newSecond, newEnv, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer ); 111 111 delete newFirst; … … 123 123 } 124 124 125 struct CompleteTypeChecker : public Visitor { 126 virtual void visit( VoidType *basicType ) { status = false; } 127 virtual void visit( BasicType *basicType ) {} 128 virtual void visit( PointerType *pointerType ) {} 129 virtual void visit( ArrayType *arrayType ) { status = ! arrayType->get_isVarLen(); } 130 virtual void visit( FunctionType *functionType ) {} 131 virtual void visit( StructInstType *aggregateUseType ) { status = aggregateUseType->get_baseStruct()->has_body(); } 132 virtual void visit( UnionInstType *aggregateUseType ) { status = aggregateUseType->get_baseUnion()->has_body(); } 133 // xxx - enum inst does not currently contain a pointer to base, this should be fixed. 134 virtual void visit( EnumInstType *aggregateUseType ) { /* status = aggregateUseType->get_baseEnum()->hasBody(); */ } 135 virtual void visit( TraitInstType *aggregateUseType ) { assert( false ); } 136 virtual void visit( TypeInstType *aggregateUseType ) { status = aggregateUseType->get_baseType()->isComplete(); } 137 virtual void visit( TupleType *tupleType ) {} // xxx - not sure if this is right, might need to recursively check complete-ness 138 virtual void visit( TypeofType *typeofType ) { assert( false ); } 139 virtual void visit( AttrType *attrType ) { assert( false ); } // xxx - not sure what to do here 140 virtual void visit( VarArgsType *varArgsType ){} // xxx - is this right? 141 virtual void visit( ZeroType *zeroType ) {} 142 virtual void visit( OneType *oneType ) {} 143 bool status = true; 144 }; 145 bool isComplete( Type * type ) { 146 CompleteTypeChecker checker; 147 assert( type ); 148 type->accept( checker ); 149 return checker.status; 150 } 151 152 bool tyVarCompatible( const TypeDecl::Data & data, Type *type, const SymTab::Indexer &indexer ) { 153 switch ( data.kind ) { 125 bool tyVarCompatible( TypeDecl::Kind kind, Type *type, const SymTab::Indexer &indexer ) { 126 switch ( kind ) { 154 127 case TypeDecl::Any: 155 128 case TypeDecl::Dtype: 156 // to bind to an object type variable, the type must not be a function type. 157 // if the type variable is specified to be a complete type then the incoming 158 // type must also be complete 159 return ! isFtype( type, indexer ) && (! data.isComplete || isComplete( type )); 129 return ! isFtype( type, indexer ); 130 160 131 case TypeDecl::Ftype: 161 132 return isFtype( type, indexer ); … … 165 136 } 166 137 167 bool bindVar( TypeInstType *typeInst, Type *other, const TypeDecl::Data & data, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {138 bool bindVar( TypeInstType *typeInst, Type *other, TypeDecl::Kind kind, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) { 168 139 OpenVarSet::const_iterator tyvar = openVars.find( typeInst->get_name() ); 169 140 assert( tyvar != openVars.end() ); … … 204 175 newClass.type->get_qualifiers() = Type::Qualifiers(); 205 176 newClass.allowWidening = widenMode.widenFirst && widenMode.widenSecond; 206 newClass. data = data;177 newClass.kind = kind; 207 178 env.add( newClass ); 208 179 } // if … … 210 181 } 211 182 212 bool bindVarToVar( TypeInstType *var1, TypeInstType *var2, const TypeDecl::Data & data, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {183 bool bindVarToVar( TypeInstType *var1, TypeInstType *var2, TypeDecl::Kind kind, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) { 213 184 bool result = true; 214 185 EqvClass class1, class2; … … 239 210 240 211 if ( type1 && type2 ) { 241 // std::c err<< "has type1 && type2" << std::endl;212 // std::cout << "has type1 && type2" << std::endl; 242 213 WidenMode newWidenMode ( widen1, widen2 ); 243 214 Type *common = 0; … … 277 248 newClass.vars.insert( var2->get_name() ); 278 249 newClass.allowWidening = widen1 && widen2; 279 newClass. data = data;250 newClass.kind = kind; 280 251 env.add( newClass ); 281 252 } // if … … 340 311 } // if 341 312 #ifdef DEBUG 342 std::c err<< "============ unifyExact" << std::endl;343 std::c err<< "type1 is ";344 type1->print( std::c err);345 std::c err<< std::endl << "type2 is ";346 type2->print( std::c err);347 std::c err<< std::endl << "openVars are ";348 printOpenVarSet( openVars, std::c err, 8 );349 std::c err<< std::endl << "input env is " << std::endl;350 debugEnv.print( std::c err, 8 );351 std::c err<< std::endl << "result env is " << std::endl;352 env.print( std::c err, 8 );353 std::c err<< "result is " << result << std::endl;313 std::cout << "============ unifyExact" << std::endl; 314 std::cout << "type1 is "; 315 type1->print( std::cout ); 316 std::cout << std::endl << "type2 is "; 317 type2->print( std::cout ); 318 std::cout << std::endl << "openVars are "; 319 printOpenVarSet( openVars, std::cout, 8 ); 320 std::cout << std::endl << "input env is " << std::endl; 321 debugEnv.print( std::cout, 8 ); 322 std::cout << std::endl << "result env is " << std::endl; 323 env.print( std::cout, 8 ); 324 std::cout << "result is " << result << std::endl; 354 325 #endif 355 326 return result; … … 366 337 bool result; 367 338 #ifdef DEBUG 368 std::c err<< "unifyInexact type 1 is ";369 type1->print( std::c err);370 std::c err<< "type 2 is ";371 type2->print( std::c err);372 std::c err<< std::endl;339 std::cout << "unifyInexact type 1 is "; 340 type1->print( std::cout ); 341 std::cout << "type 2 is "; 342 type2->print( std::cout ); 343 std::cout << std::endl; 373 344 #endif 374 345 if ( ! unifyExact( type1, type2, env, needAssertions, haveAssertions, openVars, widenMode, indexer ) ) { 375 346 #ifdef DEBUG 376 std::c err<< "unifyInexact: no exact unification found" << std::endl;347 std::cout << "unifyInexact: no exact unification found" << std::endl; 377 348 #endif 378 349 if ( ( common = commonType( type1, type2, widenMode.widenFirst, widenMode.widenSecond, indexer, env, openVars ) ) ) { 379 350 common->get_qualifiers() = tq1 + tq2; 380 351 #ifdef DEBUG 381 std::c err<< "unifyInexact: common type is ";382 common->print( std::c err);383 std::c err<< std::endl;352 std::cout << "unifyInexact: common type is "; 353 common->print( std::cout ); 354 std::cout << std::endl; 384 355 #endif 385 356 result = true; 386 357 } else { 387 358 #ifdef DEBUG 388 std::c err<< "unifyInexact: no common type found" << std::endl;359 std::cout << "unifyInexact: no common type found" << std::endl; 389 360 #endif 390 361 result = false; … … 423 394 424 395 void markAssertionSet( AssertionSet &assertions, DeclarationWithType *assert ) { 425 /// std::c err<< "assertion set is" << std::endl;426 /// printAssertionSet( assertions, std::c err, 8 );427 /// std::c err<< "looking for ";428 /// assert->print( std::c err);429 /// std::c err<< std::endl;396 /// std::cout << "assertion set is" << std::endl; 397 /// printAssertionSet( assertions, std::cout, 8 ); 398 /// std::cout << "looking for "; 399 /// assert->print( std::cout ); 400 /// std::cout << std::endl; 430 401 AssertionSet::iterator i = assertions.find( assert ); 431 402 if ( i != assertions.end() ) { 432 /// std::c err<< "found it!" << std::endl;403 /// std::cout << "found it!" << std::endl; 433 404 i->second = true; 434 405 } // if -
src/ResolvExpr/Unify.h
r66f8528 r596f987b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Unify.h -- 7 // Unify.h -- 8 8 // 9 9 // Author : Richard C. Bilson … … 37 37 bool widenFirst : 1, widenSecond : 1; 38 38 }; 39 40 bool bindVar( TypeInstType *typeInst, Type *other, const TypeDecl::Data & data, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );39 40 bool bindVar( TypeInstType *typeInst, Type *other, TypeDecl::Kind kind, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ); 41 41 bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer ); 42 42 bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType ); -
src/SymTab/Autogen.cc
r66f8528 r596f987b 24 24 #include "MakeLibCfa.h" 25 25 #include "Autogen.h" 26 #include "GenPoly/ScopedSet.h"27 #include "SymTab/Mangler.h"28 #include "GenPoly/DeclMutator.h"29 26 30 27 namespace SymTab { … … 32 29 33 30 class AutogenerateRoutines : public Visitor { 34 public:31 public: 35 32 std::list< Declaration * > &get_declsToAdd() { return declsToAdd; } 36 37 typedef Visitor Parent;38 using Parent::visit;39 33 40 34 virtual void visit( EnumDecl *enumDecl ); … … 51 45 virtual void visit( SwitchStmt *switchStmt ); 52 46 53 private: 47 AutogenerateRoutines() : functionNesting( 0 ) {} 48 private: 54 49 template< typename StmtClass > void visitStatement( StmtClass *stmt ); 55 50 56 51 std::list< Declaration * > declsToAdd; 57 52 std::set< std::string > structsDone; 58 unsigned int functionNesting = 0; // current level of nested functions53 unsigned int functionNesting; // current level of nested functions 59 54 }; 60 55 61 /// generates routines for tuple types.62 /// Doesn't really need to be a mutator, but it's easier to reuse DeclMutator than it is to use AddVisit63 /// or anything we currently have that supports adding new declarations for visitors64 class AutogenTupleRoutines : public GenPoly::DeclMutator {65 public:66 typedef GenPoly::DeclMutator Parent;67 using Parent::mutate;68 69 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl );70 71 virtual Type * mutate( TupleType *tupleType );72 73 virtual CompoundStmt * mutate( CompoundStmt *compoundStmt );74 75 private:76 unsigned int functionNesting = 0; // current level of nested functions77 GenPoly::ScopedSet< std::string > seenTuples;78 };79 80 56 void autogenerateRoutines( std::list< Declaration * > &translationUnit ) { 81 AutogenerateRoutines generator; 82 acceptAndAdd( translationUnit, generator, false ); 83 84 // needs to be done separately because AutogenerateRoutines skips types that appear as function arguments, etc. 85 // AutogenTupleRoutines tupleGenerator; 86 // tupleGenerator.mutateDeclarationList( translationUnit ); 57 AutogenerateRoutines visitor; 58 acceptAndAdd( translationUnit, visitor, false ); 87 59 } 88 60 … … 91 63 } 92 64 93 /// inserts a forward declaration for functionDecl into declsToAdd 94 void addForwardDecl( FunctionDecl * functionDecl, std::list< Declaration * > & declsToAdd ) { 95 FunctionDecl * decl = functionDecl->clone(); 96 delete decl->get_statements(); 97 decl->set_statements( NULL ); 98 declsToAdd.push_back( decl ); 99 decl->fixUniqueId(); 100 } 101 102 /// given type T, generate type of default ctor/dtor, i.e. function type void (*) (T *) 103 FunctionType * genDefaultType( Type * paramType ) { 104 FunctionType *ftype = new FunctionType( Type::Qualifiers(), false ); 105 ObjectDecl *dstParam = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), paramType->clone() ), nullptr ); 106 ftype->get_parameters().push_back( dstParam ); 107 108 return ftype; 109 } 110 111 /// given type T, generate type of copy ctor, i.e. function type void (*) (T *, T) 112 FunctionType * genCopyType( Type * paramType ) { 113 FunctionType *ftype = genDefaultType( paramType ); 114 ObjectDecl *srcParam = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr ); 115 ftype->get_parameters().push_back( srcParam ); 116 return ftype; 117 } 118 119 /// given type T, generate type of assignment, i.e. function type T (*) (T *, T) 120 FunctionType * genAssignType( Type * paramType ) { 121 FunctionType *ftype = genCopyType( paramType ); 122 ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr ); 123 ftype->get_returnVals().push_back( returnVal ); 124 return ftype; 125 } 126 127 /// true if the aggregate's layout is dynamic 128 template< typename AggrDecl > 129 bool hasDynamicLayout( AggrDecl * aggregateDecl ) { 130 for ( TypeDecl * param : aggregateDecl->get_parameters() ) { 131 if ( param->get_kind() == TypeDecl::Any ) return true; 132 } 133 return false; 134 } 135 136 /// generate a function decl from a name and type. Nesting depth determines whether 137 /// the declaration is static or not; optional paramter determines if declaration is intrinsic 138 FunctionDecl * genFunc( const std::string & fname, FunctionType * ftype, unsigned int functionNesting, bool isIntrinsic = false ) { 139 // Routines at global scope marked "static" to prevent multiple definitions in separate translation units 65 template< typename OutputIterator > 66 void makeUnionFieldsAssignment( ObjectDecl *srcParam, ObjectDecl *dstParam, OutputIterator out ) { 67 UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) ); 68 copy->get_args().push_back( new VariableExpr( dstParam ) ); 69 copy->get_args().push_back( new AddressExpr( new VariableExpr( srcParam ) ) ); 70 copy->get_args().push_back( new SizeofExpr( srcParam->get_type()->clone() ) ); 71 72 *out++ = new ExprStmt( noLabels, copy ); 73 } 74 75 //E ?=?(E volatile*, int), 76 // ?=?(E _Atomic volatile*, int); 77 void makeEnumFunctions( EnumDecl *enumDecl, EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) { 78 FunctionType *assignType = new FunctionType( Type::Qualifiers(), false ); 79 80 ObjectDecl *dstParam = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), refType ), 0 ); 81 assignType->get_parameters().push_back( dstParam ); 82 83 // void ?{}(E *); void ^?{}(E *); 84 FunctionType * ctorType = assignType->clone(); 85 FunctionType * dtorType = assignType->clone(); 86 87 ObjectDecl *srcParam = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, refType->clone(), 0 ); 88 assignType->get_parameters().push_back( srcParam ); 89 // void ?{}(E *, E); 90 FunctionType *copyCtorType = assignType->clone(); 91 92 // T ?=?(E *, E); 93 ObjectDecl *returnVal = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, refType->clone(), 0 ); 94 assignType->get_returnVals().push_back( returnVal ); 95 96 // xxx - should we also generate void ?{}(E *, int) and E ?{}(E *, E)? 97 // right now these cases work, but that might change. 98 99 // Routines at global scope marked "static" to prevent multiple definitions is separate translation units 140 100 // because each unit generates copies of the default routines for each aggregate. 141 DeclarationNode::StorageClass sc = functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static; 142 LinkageSpec::Spec spec = isIntrinsic ? LinkageSpec::Intrinsic : LinkageSpec::AutoGen; 143 FunctionDecl * decl = new FunctionDecl( fname, sc, spec, ftype, new CompoundStmt( noLabels ), true, false ); 144 decl->fixUniqueId(); 145 return decl; 146 } 147 148 /// generates a single enumeration assignment expression 149 ApplicationExpr * genEnumAssign( FunctionType * ftype, FunctionDecl * assignDecl ) { 101 // xxx - Temporary: make these functions intrinsic so they codegen as C assignment. 102 // Really they're something of a cross between instrinsic and autogen, so should 103 // probably make a new linkage type 104 FunctionDecl *assignDecl = new FunctionDecl( "?=?", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::Intrinsic, assignType, new CompoundStmt( noLabels ), true, false ); 105 FunctionDecl *ctorDecl = new FunctionDecl( "?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::Intrinsic, ctorType, new CompoundStmt( noLabels ), true, false ); 106 FunctionDecl *copyCtorDecl = new FunctionDecl( "?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::Intrinsic, copyCtorType, new CompoundStmt( noLabels ), true, false ); 107 FunctionDecl *dtorDecl = new FunctionDecl( "^?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::Intrinsic, dtorType, new CompoundStmt( noLabels ), true, false ); 108 assignDecl->fixUniqueId(); 109 ctorDecl->fixUniqueId(); 110 copyCtorDecl->fixUniqueId(); 111 dtorDecl->fixUniqueId(); 112 150 113 // enum copy construct and assignment is just C-style assignment. 151 114 // this looks like a bad recursive call, but code gen will turn it into 152 115 // a C-style assignment. 153 116 // This happens before function pointer type conversion, so need to do it manually here 154 // NOTE: ftype is not necessarily the functionType belonging to assignDecl - ftype is the155 // type of the function that this expression is being generated for (so that the correct156 // parameters) are using in the variable exprs157 assert( ftype->get_parameters().size() == 2 );158 ObjectDecl * dstParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );159 ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );160 161 117 VariableExpr * assignVarExpr = new VariableExpr( assignDecl ); 162 118 Type * assignVarExprType = assignVarExpr->get_result(); … … 166 122 assignExpr->get_args().push_back( new VariableExpr( dstParam ) ); 167 123 assignExpr->get_args().push_back( new VariableExpr( srcParam ) ); 168 return assignExpr;169 }170 171 // E ?=?(E volatile*, int),172 // ?=?(E _Atomic volatile*, int);173 void makeEnumFunctions( EnumDecl *enumDecl, EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) {174 175 // T ?=?(E *, E);176 FunctionType *assignType = genAssignType( refType );177 178 // void ?{}(E *); void ^?{}(E *);179 FunctionType * ctorType = genDefaultType( refType->clone() );180 FunctionType * dtorType = genDefaultType( refType->clone() );181 182 // void ?{}(E *, E);183 FunctionType *copyCtorType = genCopyType( refType->clone() );184 185 // xxx - should we also generate void ?{}(E *, int) and E ?{}(E *, E)?186 // right now these cases work, but that might change.187 188 // xxx - Temporary: make these functions intrinsic so they codegen as C assignment.189 // Really they're something of a cross between instrinsic and autogen, so should190 // probably make a new linkage type191 FunctionDecl *assignDecl = genFunc( "?=?", assignType, functionNesting, true );192 FunctionDecl *ctorDecl = genFunc( "?{}", ctorType, functionNesting, true );193 FunctionDecl *copyCtorDecl = genFunc( "?{}", copyCtorType, functionNesting, true );194 FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting, true );195 124 196 125 // body is either return stmt or expr stmt 197 assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, genEnumAssign( assignType, assignDecl ) ) ); 198 copyCtorDecl->get_statements()->get_kids().push_back( new ExprStmt( noLabels, genEnumAssign( copyCtorType, assignDecl ) ) ); 199 126 assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, assignExpr ) ); 127 copyCtorDecl->get_statements()->get_kids().push_back( new ExprStmt( noLabels, assignExpr->clone() ) ); 128 129 declsToAdd.push_back( assignDecl ); 200 130 declsToAdd.push_back( ctorDecl ); 201 131 declsToAdd.push_back( copyCtorDecl ); 202 132 declsToAdd.push_back( dtorDecl ); 203 declsToAdd.push_back( assignDecl ); // assignment should come last since it uses copy constructor in return 204 } 205 206 /// generates a single struct member operation (constructor call, destructor call, assignment call) 207 void makeStructMemberOp( ObjectDecl * dstParam, Expression * src, DeclarationWithType * field, FunctionDecl * func, bool isDynamicLayout, bool forward = true ) { 133 } 134 135 /// Clones a reference type, replacing any parameters it may have with a clone of the provided list 136 template< typename GenericInstType > 137 GenericInstType *cloneWithParams( GenericInstType *refType, const std::list< Expression* >& params ) { 138 GenericInstType *clone = refType->clone(); 139 clone->get_parameters().clear(); 140 cloneAll( params, clone->get_parameters() ); 141 return clone; 142 } 143 144 /// Creates a new type decl that's the same as src, but renamed and with only the ?=?, ?{} (default and copy), and ^?{} assertions (for complete types only) 145 TypeDecl *cloneAndRename( TypeDecl *src, const std::string &name ) { 146 // TypeDecl *dst = new TypeDecl( name, src->get_storageClass(), 0, src->get_kind() ); 147 148 // if ( src->get_kind() == TypeDecl::Any ) { 149 // TypeInstType *opParamType = new TypeInstType( Type::Qualifiers(), name, dst ); 150 // FunctionType *opFunctionType = new FunctionType( Type::Qualifiers(), false ); 151 // opFunctionType->get_parameters().push_back( 152 // new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), opParamType->clone() ), 0 ) ); 153 // FunctionDecl *ctorAssert = new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, opFunctionType->clone(), 0, false, false ); 154 // FunctionDecl *dtorAssert = new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, opFunctionType->clone(), 0, false, false ); 155 156 // opFunctionType->get_parameters().push_back( 157 // new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, opParamType, 0 ) ); 158 // FunctionDecl *copyCtorAssert = new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, opFunctionType->clone(), 0, false, false ); 159 160 // opFunctionType->get_returnVals().push_back( 161 // new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, opParamType->clone(), 0 ) ); 162 // FunctionDecl *assignAssert = new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, opFunctionType, 0, false, false ); 163 164 165 // dst->get_assertions().push_back( assignAssert ); 166 // dst->get_assertions().push_back( ctorAssert ); 167 // dst->get_assertions().push_back( dtorAssert ); 168 // dst->get_assertions().push_back( copyCtorAssert ); 169 // } 170 171 TypeDecl *dst = new TypeDecl( src->get_name(), src->get_storageClass(), 0, src->get_kind() ); 172 cloneAll(src->get_assertions(), dst->get_assertions()); 173 return dst; 174 } 175 176 void makeStructMemberOp( ObjectDecl * dstParam, Expression * src, DeclarationWithType * field, FunctionDecl * func, TypeSubstitution & genericSubs, bool isDynamicLayout, bool forward = true ) { 177 // if ( isDynamicLayout && src ) { 178 // genericSubs.apply( src ); 179 // } 180 208 181 ObjectDecl * returnVal = NULL; 209 182 if ( ! func->get_functionType()->get_returnVals().empty() ) { … … 214 187 215 188 // assign to destination (and return value if generic) 216 UntypedExpr *derefExpr = UntypedExpr::createDeref( new VariableExpr( dstParam ) ); 189 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) ); 190 derefExpr->get_args().push_back( new VariableExpr( dstParam ) ); 217 191 Expression *dstselect = new MemberExpr( field, derefExpr ); 218 192 genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward ); 219 193 220 194 if ( isDynamicLayout && returnVal ) { 221 // xxx - there used to be a dereference on returnVal, but this seems to have been wrong? 222 Expression *retselect = new MemberExpr( field, new VariableExpr( returnVal ) ); 195 UntypedExpr *derefRet = new UntypedExpr( new NameExpr( "*?" ) ); 196 derefRet->get_args().push_back( new VariableExpr( returnVal ) ); 197 Expression *retselect = new MemberExpr( field, derefRet ); 223 198 genImplicitCall( srcParam, retselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward ); 224 199 } // if 225 200 } 226 201 227 /// generates the body of a struct function by iterating the struct members (via parameters) - generates default ctor, copy ctor, assignment, and dtor bodies, but NOT field ctor bodies228 202 template<typename Iterator> 229 void makeStructFunctionBody( Iterator member, Iterator end, FunctionDecl * func, bool isDynamicLayout, bool forward = true ) {203 void makeStructFunctionBody( Iterator member, Iterator end, FunctionDecl * func, TypeSubstitution & genericSubs, bool isDynamicLayout, bool forward = true ) { 230 204 for ( ; member != end; ++member ) { 231 205 if ( DeclarationWithType *field = dynamic_cast< DeclarationWithType * >( *member ) ) { // otherwise some form of type declaration, e.g. Aggregate … … 263 237 264 238 Expression *srcselect = srcParam ? new MemberExpr( field, new VariableExpr( srcParam ) ) : NULL; 265 makeStructMemberOp( dstParam, srcselect, field, func, isDynamicLayout, forward );239 makeStructMemberOp( dstParam, srcselect, field, func, genericSubs, isDynamicLayout, forward ); 266 240 } // if 267 241 } // for … … 271 245 /// void ?{}(A *, int) and void?{}(A *, int, int) for a struct A which has two int fields. 272 246 template<typename Iterator> 273 void makeStructFieldCtorBody( Iterator member, Iterator end, FunctionDecl * func, bool isDynamicLayout ) {247 void makeStructFieldCtorBody( Iterator member, Iterator end, FunctionDecl * func, TypeSubstitution & genericSubs, bool isDynamicLayout ) { 274 248 FunctionType * ftype = func->get_functionType(); 275 249 std::list<DeclarationWithType*> & params = ftype->get_parameters(); … … 297 271 // matching parameter, initialize field with copy ctor 298 272 Expression *srcselect = new VariableExpr(*parameter); 299 makeStructMemberOp( dstParam, srcselect, field, func, isDynamicLayout );273 makeStructMemberOp( dstParam, srcselect, field, func, genericSubs, isDynamicLayout ); 300 274 ++parameter; 301 275 } else { 302 276 // no matching parameter, initialize field with default ctor 303 makeStructMemberOp( dstParam, NULL, field, func, isDynamicLayout );277 makeStructMemberOp( dstParam, NULL, field, func, genericSubs, isDynamicLayout ); 304 278 } 305 279 } … … 307 281 } 308 282 309 /// generates struct constructors, destructor, and assignment functions 283 void addForwardDecl( FunctionDecl * functionDecl, std::list< Declaration * > & declsToAdd ) { 284 FunctionDecl * decl = functionDecl->clone(); 285 delete decl->get_statements(); 286 decl->set_statements( NULL ); 287 declsToAdd.push_back( decl ); 288 decl->fixUniqueId(); 289 } 290 310 291 void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd ) { 292 FunctionType *assignType = new FunctionType( Type::Qualifiers(), false ); 311 293 312 294 // Make function polymorphic in same parameters as generic struct, if applicable 313 const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions 314 bool isDynamicLayout = hasDynamicLayout( aggregateDecl ); // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for union) 295 bool isDynamicLayout = false; // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for union) 296 std::list< TypeDecl* >& genericParams = aggregateDecl->get_parameters(); 297 std::list< Expression* > structParams; // List of matching parameters to put on types 298 TypeSubstitution genericSubs; // Substitutions to make to member types of struct 299 for ( std::list< TypeDecl* >::const_iterator param = genericParams.begin(); param != genericParams.end(); ++param ) { 300 if ( (*param)->get_kind() == TypeDecl::Any ) isDynamicLayout = true; 301 TypeDecl *typeParam = cloneAndRename( *param, "_autoassign_" + aggregateDecl->get_name() + "_" + (*param)->get_name() ); 302 assignType->get_forall().push_back( typeParam ); 303 TypeInstType *newParamType = new TypeInstType( Type::Qualifiers(), typeParam->get_name(), typeParam ); 304 genericSubs.add( (*param)->get_name(), newParamType ); 305 structParams.push_back( new TypeExpr( newParamType ) ); 306 } 307 308 ObjectDecl *dstParam = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), cloneWithParams( refType, structParams ) ), 0 ); 309 assignType->get_parameters().push_back( dstParam ); 310 311 // void ?{}(T *); void ^?{}(T *); 312 FunctionType *ctorType = assignType->clone(); 313 FunctionType *dtorType = assignType->clone(); 314 315 ObjectDecl *srcParam = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, structParams ), 0 ); 316 assignType->get_parameters().push_back( srcParam ); 317 318 // void ?{}(T *, T); 319 FunctionType *copyCtorType = assignType->clone(); 315 320 316 321 // T ?=?(T *, T); 317 FunctionType *assignType = genAssignType( refType ); 318 cloneAll( typeParams, assignType->get_forall() ); 319 320 // void ?{}(T *); void ^?{}(T *); 321 FunctionType *ctorType = genDefaultType( refType ); 322 cloneAll( typeParams, ctorType->get_forall() ); 323 FunctionType *dtorType = genDefaultType( refType ); 324 cloneAll( typeParams, dtorType->get_forall() ); 325 326 // void ?{}(T *, T); 327 FunctionType *copyCtorType = genCopyType( refType ); 328 cloneAll( typeParams, copyCtorType->get_forall() ); 329 330 FunctionDecl *assignDecl = genFunc( "?=?", assignType, functionNesting ); 331 FunctionDecl *ctorDecl = genFunc( "?{}", ctorType, functionNesting ); 332 FunctionDecl *copyCtorDecl = genFunc( "?{}", copyCtorType, functionNesting ); 333 FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting ); 322 ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, structParams ), 0 ); 323 assignType->get_returnVals().push_back( returnVal ); 324 325 // Routines at global scope marked "static" to prevent multiple definitions is separate translation units 326 // because each unit generates copies of the default routines for each aggregate. 327 FunctionDecl *assignDecl = new FunctionDecl( "?=?", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, assignType, new CompoundStmt( noLabels ), true, false ); 328 FunctionDecl *ctorDecl = new FunctionDecl( "?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, ctorType, new CompoundStmt( noLabels ), true, false ); 329 FunctionDecl *copyCtorDecl = new FunctionDecl( "?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, copyCtorType, new CompoundStmt( noLabels ), true, false ); 330 FunctionDecl *dtorDecl = new FunctionDecl( "^?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, dtorType, new CompoundStmt( noLabels ), true, false ); 331 assignDecl->fixUniqueId(); 332 ctorDecl->fixUniqueId(); 333 copyCtorDecl->fixUniqueId(); 334 dtorDecl->fixUniqueId(); 334 335 335 336 if ( functionNesting == 0 ) { 336 337 // forward declare if top-level struct, so that 337 338 // type is complete as soon as its body ends 338 // Note: this is necessary if we want structs which contain339 // generic (otype) structs as members.340 339 addForwardDecl( assignDecl, declsToAdd ); 341 340 addForwardDecl( ctorDecl, declsToAdd ); … … 366 365 } 367 366 memCtorType->get_parameters().push_back( new ObjectDecl( member->get_name(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, member->get_type()->clone(), 0 ) ); 368 FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting ); 369 makeStructFieldCtorBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), ctor, isDynamicLayout ); 367 FunctionDecl * ctor = new FunctionDecl( "?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, memCtorType->clone(), new CompoundStmt( noLabels ), true, false ); 368 ctor->fixUniqueId(); 369 makeStructFieldCtorBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), ctor, genericSubs, isDynamicLayout ); 370 370 memCtors.push_back( ctor ); 371 371 } … … 373 373 374 374 // generate appropriate calls to member ctor, assignment 375 makeStructFunctionBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), assignDecl, isDynamicLayout );376 makeStructFunctionBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), ctorDecl, isDynamicLayout );377 makeStructFunctionBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), copyCtorDecl, isDynamicLayout );375 makeStructFunctionBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), assignDecl, genericSubs, isDynamicLayout ); 376 makeStructFunctionBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), ctorDecl, genericSubs, isDynamicLayout ); 377 makeStructFunctionBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), copyCtorDecl, genericSubs, isDynamicLayout ); 378 378 // needs to do everything in reverse, so pass "forward" as false 379 makeStructFunctionBody( aggregateDecl->get_members().rbegin(), aggregateDecl->get_members().rend(), dtorDecl, isDynamicLayout, false ); 380 381 assert( assignType->get_parameters().size() == 2 ); 382 ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() ); 383 assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 384 379 makeStructFunctionBody( aggregateDecl->get_members().rbegin(), aggregateDecl->get_members().rend(), dtorDecl, genericSubs, isDynamicLayout, false ); 380 381 if ( ! isDynamicLayout ) assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 382 383 declsToAdd.push_back( assignDecl ); 385 384 declsToAdd.push_back( ctorDecl ); 386 385 declsToAdd.push_back( copyCtorDecl ); 387 386 declsToAdd.push_back( dtorDecl ); 388 declsToAdd.push_back( assignDecl ); // assignment should come last since it uses copy constructor in return389 387 declsToAdd.splice( declsToAdd.end(), memCtors ); 390 388 } 391 389 392 /// generate a single union assignment expression (using memcpy)393 template< typename OutputIterator >394 void makeUnionFieldsAssignment( ObjectDecl * srcParam, ObjectDecl * dstParam, OutputIterator out ) {395 UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) );396 copy->get_args().push_back( new VariableExpr( dstParam ) );397 copy->get_args().push_back( new AddressExpr( new VariableExpr( srcParam ) ) );398 copy->get_args().push_back( new SizeofExpr( srcParam->get_type()->clone() ) );399 *out++ = new ExprStmt( noLabels, copy );400 }401 402 /// generates the body of a union assignment/copy constructor/field constructor403 void makeUnionAssignBody( FunctionDecl * funcDecl, bool isDynamicLayout ) {404 FunctionType * ftype = funcDecl->get_functionType();405 assert( ftype->get_parameters().size() == 2 );406 ObjectDecl * dstParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );407 ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );408 ObjectDecl * returnVal = nullptr;409 if ( ! ftype->get_returnVals().empty() ) {410 returnVal = safe_dynamic_cast< ObjectDecl * >( ftype->get_returnVals().front() );411 }412 413 makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( funcDecl->get_statements()->get_kids() ) );414 if ( returnVal ) {415 if ( isDynamicLayout ) makeUnionFieldsAssignment( srcParam, returnVal, back_inserter( funcDecl->get_statements()->get_kids() ) );416 else funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );417 }418 }419 420 /// generates union constructors, destructors, and assignment operator421 390 void makeUnionFunctions( UnionDecl *aggregateDecl, UnionInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd ) { 391 FunctionType *assignType = new FunctionType( Type::Qualifiers(), false ); 392 422 393 // Make function polymorphic in same parameters as generic union, if applicable 423 const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions 424 bool isDynamicLayout = hasDynamicLayout( aggregateDecl ); // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for struct) 394 bool isDynamicLayout = false; // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for struct) 395 std::list< TypeDecl* >& genericParams = aggregateDecl->get_parameters(); 396 std::list< Expression* > unionParams; // List of matching parameters to put on types 397 for ( std::list< TypeDecl* >::const_iterator param = genericParams.begin(); param != genericParams.end(); ++param ) { 398 if ( (*param)->get_kind() == TypeDecl::Any ) isDynamicLayout = true; 399 TypeDecl *typeParam = cloneAndRename( *param, "_autoassign_" + aggregateDecl->get_name() + "_" + (*param)->get_name() ); 400 assignType->get_forall().push_back( typeParam ); 401 unionParams.push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeParam->get_name(), typeParam ) ) ); 402 } 403 404 ObjectDecl *dstParam = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), cloneWithParams( refType, unionParams ) ), 0 ); 405 assignType->get_parameters().push_back( dstParam ); 425 406 426 407 // default ctor/dtor need only first parameter 427 // void ?{}(T *); void ^?{}(T *); 428 FunctionType *ctorType = genDefaultType( refType ); 429 FunctionType *dtorType = genDefaultType( refType ); 408 FunctionType * ctorType = assignType->clone(); 409 FunctionType * dtorType = assignType->clone(); 410 411 ObjectDecl *srcParam = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, unionParams ), 0 ); 412 assignType->get_parameters().push_back( srcParam ); 430 413 431 414 // copy ctor needs both parameters 432 // void ?{}(T *, T); 433 FunctionType *copyCtorType = genCopyType( refType ); 415 FunctionType * copyCtorType = assignType->clone(); 434 416 435 417 // assignment needs both and return value 436 // T ?=?(T *, T); 437 FunctionType *assignType = genAssignType( refType ); 438 439 cloneAll( typeParams, ctorType->get_forall() ); 440 cloneAll( typeParams, dtorType->get_forall() ); 441 cloneAll( typeParams, copyCtorType->get_forall() ); 442 cloneAll( typeParams, assignType->get_forall() ); 418 ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, cloneWithParams( refType, unionParams ), 0 ); 419 assignType->get_returnVals().push_back( returnVal ); 443 420 444 421 // Routines at global scope marked "static" to prevent multiple definitions is separate translation units 445 422 // because each unit generates copies of the default routines for each aggregate. 446 FunctionDecl *assignDecl = genFunc( "?=?", assignType, functionNesting ); 447 FunctionDecl *ctorDecl = genFunc( "?{}", ctorType, functionNesting ); 448 FunctionDecl *copyCtorDecl = genFunc( "?{}", copyCtorType, functionNesting ); 449 FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting ); 450 451 makeUnionAssignBody( assignDecl, isDynamicLayout ); 423 FunctionDecl *assignDecl = new FunctionDecl( "?=?", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, assignType, new CompoundStmt( noLabels ), true, false ); 424 FunctionDecl *ctorDecl = new FunctionDecl( "?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, ctorType, new CompoundStmt( noLabels ), true, false ); 425 FunctionDecl *copyCtorDecl = new FunctionDecl( "?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, copyCtorType, NULL, true, false ); 426 FunctionDecl *dtorDecl = new FunctionDecl( "^?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, dtorType, new CompoundStmt( noLabels ), true, false ); 427 428 assignDecl->fixUniqueId(); 429 ctorDecl->fixUniqueId(); 430 copyCtorDecl->fixUniqueId(); 431 dtorDecl->fixUniqueId(); 432 433 makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( assignDecl->get_statements()->get_kids() ) ); 434 if ( isDynamicLayout ) makeUnionFieldsAssignment( srcParam, returnVal, back_inserter( assignDecl->get_statements()->get_kids() ) ); 435 else assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 452 436 453 437 // body of assignment and copy ctor is the same 454 makeUnionAssignBody( copyCtorDecl, isDynamicLayout);438 copyCtorDecl->set_statements( assignDecl->get_statements()->clone() ); 455 439 456 440 // create a constructor which takes the first member type as a parameter. … … 465 449 FunctionType * memCtorType = ctorType->clone(); 466 450 memCtorType->get_parameters().push_back( srcParam ); 467 FunctionDecl * ctor = genFunc( "?{}", memCtorType, functionNesting ); 468 469 makeUnionAssignBody( ctor, isDynamicLayout ); 451 FunctionDecl * ctor = new FunctionDecl( "?{}", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, memCtorType, new CompoundStmt( noLabels ), true, false ); 452 ctor->fixUniqueId(); 453 454 makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( ctor->get_statements()->get_kids() ) ); 470 455 memCtors.push_back( ctor ); 471 456 // only generate a ctor for the first field … … 474 459 } 475 460 461 declsToAdd.push_back( assignDecl ); 476 462 declsToAdd.push_back( ctorDecl ); 477 463 declsToAdd.push_back( copyCtorDecl ); 478 464 declsToAdd.push_back( dtorDecl ); 479 declsToAdd.push_back( assignDecl ); // assignment should come last since it uses copy constructor in return480 465 declsToAdd.splice( declsToAdd.end(), memCtors ); 481 466 } … … 493 478 if ( ! structDecl->get_members().empty() && structsDone.find( structDecl->get_name() ) == structsDone.end() ) { 494 479 StructInstType structInst( Type::Qualifiers(), structDecl->get_name() ); 495 for ( TypeDecl * typeDecl : structDecl->get_parameters() ) {496 structInst.get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );497 }498 480 structInst.set_baseStruct( structDecl ); 499 481 makeStructFunctions( structDecl, &structInst, functionNesting, declsToAdd ); … … 506 488 UnionInstType unionInst( Type::Qualifiers(), unionDecl->get_name() ); 507 489 unionInst.set_baseUnion( unionDecl ); 508 for ( TypeDecl * typeDecl : unionDecl->get_parameters() ) {509 unionInst.get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );510 }511 490 makeUnionFunctions( unionDecl, &unionInst, functionNesting, declsToAdd ); 512 491 } // if … … 514 493 515 494 void AutogenerateRoutines::visit( TypeDecl *typeDecl ) { 495 CompoundStmt *stmts = 0; 516 496 TypeInstType *typeInst = new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), false ); 517 497 typeInst->set_baseType( typeDecl ); 518 ObjectDecl *src = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, typeInst->clone(), nullptr ); 519 ObjectDecl *dst = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), typeInst->clone() ), nullptr ); 520 521 std::list< Statement * > stmts; 498 ObjectDecl *src = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, typeInst->clone(), 0 ); 499 ObjectDecl *dst = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), typeInst->clone() ), 0 ); 522 500 if ( typeDecl->get_base() ) { 523 501 // xxx - generate ctor/dtors for typedecls, e.g. 524 502 // otype T = int *; 503 stmts = new CompoundStmt( std::list< Label >() ); 525 504 UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); 526 505 assign->get_args().push_back( new CastExpr( new VariableExpr( dst ), new PointerType( Type::Qualifiers(), typeDecl->get_base()->clone() ) ) ); 527 506 assign->get_args().push_back( new CastExpr( new VariableExpr( src ), typeDecl->get_base()->clone() ) ); 528 stmts .push_back( new ReturnStmt( std::list< Label >(), assign ) );507 stmts->get_kids().push_back( new ReturnStmt( std::list< Label >(), assign ) ); 529 508 } // if 530 509 FunctionType *type = new FunctionType( Type::Qualifiers(), false ); … … 532 511 type->get_parameters().push_back( dst ); 533 512 type->get_parameters().push_back( src ); 534 FunctionDecl *func = genFunc( "?=?", type, functionNesting ); 535 func->get_statements()->get_kids() = stmts; 513 FunctionDecl *func = new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::AutoGen, type, stmts, true, false ); 536 514 declsToAdd.push_back( func ); 537 515 } … … 578 556 visitStatement( switchStmt ); 579 557 } 580 581 void makeTupleFunctionBody( FunctionDecl * function ) {582 FunctionType * ftype = function->get_functionType();583 assertf( ftype->get_parameters().size() == 1 || ftype->get_parameters().size() == 2, "too many parameters in generated tuple function" );584 585 UntypedExpr * untyped = new UntypedExpr( new NameExpr( function->get_name() ) );586 587 /// xxx - &* is used to make this easier for later passes to handle588 untyped->get_args().push_back( new AddressExpr( UntypedExpr::createDeref( new VariableExpr( ftype->get_parameters().front() ) ) ) );589 if ( ftype->get_parameters().size() == 2 ) {590 untyped->get_args().push_back( new VariableExpr( ftype->get_parameters().back() ) );591 }592 function->get_statements()->get_kids().push_back( new ExprStmt( noLabels, untyped ) );593 function->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, UntypedExpr::createDeref( new VariableExpr( ftype->get_parameters().front() ) ) ) );594 }595 596 Type * AutogenTupleRoutines::mutate( TupleType * tupleType ) {597 tupleType = safe_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) );598 std::string mangleName = SymTab::Mangler::mangleType( tupleType );599 if ( seenTuples.find( mangleName ) != seenTuples.end() ) return tupleType;600 seenTuples.insert( mangleName );601 602 // T ?=?(T *, T);603 FunctionType *assignType = genAssignType( tupleType );604 605 // void ?{}(T *); void ^?{}(T *);606 FunctionType *ctorType = genDefaultType( tupleType );607 FunctionType *dtorType = genDefaultType( tupleType );608 609 // void ?{}(T *, T);610 FunctionType *copyCtorType = genCopyType( tupleType );611 612 std::set< TypeDecl* > done;613 std::list< TypeDecl * > typeParams;614 for ( Type * t : *tupleType ) {615 if ( TypeInstType * ty = dynamic_cast< TypeInstType * >( t ) ) {616 if ( ! done.count( ty->get_baseType() ) ) {617 TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), DeclarationNode::NoStorageClass, nullptr, TypeDecl::Any );618 TypeInstType * inst = new TypeInstType( Type::Qualifiers(), newDecl->get_name(), newDecl );619 newDecl->get_assertions().push_back( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genAssignType( inst ), nullptr, true, false ) );620 newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genDefaultType( inst ), nullptr, true, false ) );621 newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genCopyType( inst ), nullptr, true, false ) );622 newDecl->get_assertions().push_back( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genDefaultType( inst ), nullptr, true, false ) );623 typeParams.push_back( newDecl );624 done.insert( ty->get_baseType() );625 }626 }627 }628 cloneAll( typeParams, ctorType->get_forall() );629 cloneAll( typeParams, dtorType->get_forall() );630 cloneAll( typeParams, copyCtorType->get_forall() );631 cloneAll( typeParams, assignType->get_forall() );632 633 FunctionDecl *assignDecl = genFunc( "?=?", assignType, functionNesting );634 FunctionDecl *ctorDecl = genFunc( "?{}", ctorType, functionNesting );635 FunctionDecl *copyCtorDecl = genFunc( "?{}", copyCtorType, functionNesting );636 FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting );637 638 makeTupleFunctionBody( assignDecl );639 makeTupleFunctionBody( ctorDecl );640 makeTupleFunctionBody( copyCtorDecl );641 makeTupleFunctionBody( dtorDecl );642 643 addDeclaration( ctorDecl );644 addDeclaration( copyCtorDecl );645 addDeclaration( dtorDecl );646 addDeclaration( assignDecl ); // assignment should come last since it uses copy constructor in return647 648 return tupleType;649 }650 651 DeclarationWithType * AutogenTupleRoutines::mutate( FunctionDecl *functionDecl ) {652 functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) );653 mutateAll( functionDecl->get_oldDecls(), *this );654 functionNesting += 1;655 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );656 functionNesting -= 1;657 return functionDecl;658 }659 660 CompoundStmt * AutogenTupleRoutines::mutate( CompoundStmt *compoundStmt ) {661 seenTuples.beginScope();662 compoundStmt = safe_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) );663 seenTuples.endScope();664 return compoundStmt;665 }666 558 } // SymTab -
src/SymTab/Indexer.cc
r66f8528 r596f987b 40 40 41 41 namespace SymTab { 42 struct NewScope {43 NewScope( SymTab::Indexer & indexer ) : indexer( indexer ) { indexer.enterScope(); }44 ~NewScope() { indexer.leaveScope(); }45 SymTab::Indexer & indexer;46 };47 48 42 template< typename TreeType, typename VisitorType > 49 43 inline void acceptNewScope( TreeType *tree, VisitorType &visitor ) { … … 460 454 void Indexer::visit( TupleAssignExpr *tupleExpr ) { 461 455 acceptNewScope( tupleExpr->get_result(), *this ); 462 maybeAccept( tupleExpr->get_stmtExpr(), *this ); 456 enterScope(); 457 acceptAll( tupleExpr->get_tempDecls(), *this ); 458 acceptAll( tupleExpr->get_assigns(), *this ); 459 leaveScope(); 463 460 } 464 461 -
src/SymTab/Indexer.h
r66f8528 r596f987b 25 25 class Indexer : public Visitor { 26 26 public: 27 explicitIndexer( bool useDebug = false );27 Indexer( bool useDebug = false ); 28 28 29 29 Indexer( const Indexer &that ); -
src/SymTab/Validate.cc
r66f8528 r596f987b 61 61 #include <algorithm> 62 62 #include "InitTweak/InitTweak.h" 63 #include "CodeGen/CodeGenerator.h"64 63 65 64 #define debugPrint( x ) if ( doDebug ) { std::cout << x; } 66 65 67 66 namespace SymTab { 68 class HoistStruct final: public Visitor {67 class HoistStruct : public Visitor { 69 68 public: 70 69 /// Flattens nested struct types … … 87 86 }; 88 87 89 /// Fix return types so that every function returns exactly one value90 class ReturnTypeFixer final : public Visitor {91 public:92 93 typedef Visitor Parent;94 using Parent::visit;95 96 static void fix( std::list< Declaration * > &translationUnit );97 98 virtual void visit( FunctionDecl * functionDecl );99 100 virtual void visit( FunctionType * ftype );101 };102 103 88 /// Replaces enum types by int, and function or array types in function parameter and return lists by appropriate pointers. 104 class EnumAndPointerDecayPass final: public Visitor {89 class EnumAndPointerDecayPass : public Visitor { 105 90 typedef Visitor Parent; 106 91 virtual void visit( EnumDecl *aggregateDecl ); … … 109 94 110 95 /// Associates forward declarations of aggregates with their definitions 111 class LinkReferenceToTypesfinal : public Indexer {96 class Pass2 final : public Indexer { 112 97 typedef Indexer Parent; 113 98 public: 114 LinkReferenceToTypes( bool doDebug, const Indexer *indexer );99 Pass2( bool doDebug, const Indexer *indexer ); 115 100 private: 116 101 using Indexer::visit; … … 208 193 void validate( std::list< Declaration * > &translationUnit, bool doDebug ) { 209 194 EnumAndPointerDecayPass epc; 210 LinkReferenceToTypes lrt( doDebug, 0 );195 Pass2 pass2( doDebug, 0 ); 211 196 Pass3 pass3( 0 ); 212 197 CompoundLiteral compoundliteral; … … 214 199 EliminateTypedef::eliminateTypedef( translationUnit ); 215 200 HoistStruct::hoistStruct( translationUnit ); 216 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen217 201 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecayPass 218 202 acceptAll( translationUnit, epc ); 219 acceptAll( translationUnit, lrt);203 acceptAll( translationUnit, pass2 ); 220 204 ReturnChecker::checkFunctionReturns( translationUnit ); 221 205 compoundliteral.mutateDeclarationList( translationUnit ); … … 226 210 void validateType( Type *type, const Indexer *indexer ) { 227 211 EnumAndPointerDecayPass epc; 228 LinkReferenceToTypes lrt( false, indexer );212 Pass2 pass2( false, indexer ); 229 213 Pass3 pass3( indexer ); 230 214 type->accept( epc ); 231 type->accept( lrt);215 type->accept( pass2 ); 232 216 type->accept( pass3 ); 233 217 } … … 340 324 } 341 325 342 LinkReferenceToTypes::LinkReferenceToTypes( bool doDebug, const Indexer *other_indexer ) : Indexer( doDebug ) {326 Pass2::Pass2( bool doDebug, const Indexer *other_indexer ) : Indexer( doDebug ) { 343 327 if ( other_indexer ) { 344 328 indexer = other_indexer; … … 348 332 } 349 333 350 void LinkReferenceToTypes::visit( StructInstType *structInst ) {334 void Pass2::visit( StructInstType *structInst ) { 351 335 Parent::visit( structInst ); 352 336 StructDecl *st = indexer->lookupStruct( structInst->get_name() ); … … 362 346 } 363 347 364 void LinkReferenceToTypes::visit( UnionInstType *unionInst ) {348 void Pass2::visit( UnionInstType *unionInst ) { 365 349 Parent::visit( unionInst ); 366 350 UnionDecl *un = indexer->lookupUnion( unionInst->get_name() ); … … 375 359 } 376 360 377 void LinkReferenceToTypes::visit( TraitInstType *contextInst ) {361 void Pass2::visit( TraitInstType *contextInst ) { 378 362 Parent::visit( contextInst ); 379 if ( contextInst->get_name() == "sized" ) {380 // "sized" is a special trait with no members - just flick the sized status on for the type variable381 if ( contextInst->get_parameters().size() != 1 ) {382 throw SemanticError( "incorrect number of context parameters: ", contextInst );383 }384 TypeExpr * param = safe_dynamic_cast< TypeExpr * > ( contextInst->get_parameters().front() );385 TypeInstType * inst = safe_dynamic_cast< TypeInstType * > ( param->get_type() );386 TypeDecl * decl = inst->get_baseType();387 decl->set_sized( true );388 // since "sized" is special, the next few steps don't apply389 return;390 }391 363 TraitDecl *ctx = indexer->lookupTrait( contextInst->get_name() ); 392 364 if ( ! ctx ) { … … 414 386 } 415 387 416 void LinkReferenceToTypes::visit( StructDecl *structDecl ) {388 void Pass2::visit( StructDecl *structDecl ) { 417 389 // visit struct members first so that the types of self-referencing members are updated properly 418 390 Parent::visit( structDecl ); … … 428 400 } 429 401 430 void LinkReferenceToTypes::visit( UnionDecl *unionDecl ) {402 void Pass2::visit( UnionDecl *unionDecl ) { 431 403 Parent::visit( unionDecl ); 432 404 if ( ! unionDecl->get_members().empty() ) { … … 441 413 } 442 414 443 void LinkReferenceToTypes::visit( TypeInstType *typeInst ) {415 void Pass2::visit( TypeInstType *typeInst ) { 444 416 if ( NamedTypeDecl *namedTypeDecl = lookupType( typeInst->get_name() ) ) { 445 417 if ( TypeDecl *typeDecl = dynamic_cast< TypeDecl * >( namedTypeDecl ) ) { … … 612 584 613 585 typedeclNames[ typeDecl->get_name() ] = typeDecl; 614 return Mutator::mutate( typeDecl );586 return typeDecl; 615 587 } 616 588 … … 763 735 return new VariableExpr( newtempvar ); 764 736 } 765 766 void ReturnTypeFixer::fix( std::list< Declaration * > &translationUnit ) {767 ReturnTypeFixer fixer;768 acceptAll( translationUnit, fixer );769 }770 771 void ReturnTypeFixer::visit( FunctionDecl * functionDecl ) {772 Parent::visit( functionDecl );773 FunctionType * ftype = functionDecl->get_functionType();774 std::list< DeclarationWithType * > & retVals = ftype->get_returnVals();775 assertf( retVals.size() == 0 || retVals.size() == 1, "Function %s has too many return values: %d", functionDecl->get_name().c_str(), retVals.size() );776 if ( retVals.size() == 1 ) {777 // ensure all function return values have a name - use the name of the function to disambiguate (this also provides a nice bit of help for debugging)778 // ensure other return values have a name779 DeclarationWithType * ret = retVals.front();780 if ( ret->get_name() == "" ) {781 ret->set_name( toString( "_retval_", CodeGen::genName( functionDecl ) ) );782 }783 }784 }785 786 void ReturnTypeFixer::visit( FunctionType * ftype ) {787 // xxx - need to handle named return values - this information needs to be saved somehow788 // so that resolution has access to the names.789 // Note that this pass needs to happen early so that other passes which look for tuple types790 // find them in all of the right places, including function return types.791 std::list< DeclarationWithType * > & retVals = ftype->get_returnVals();792 if ( retVals.size() > 1 ) {793 // generate a single return parameter which is the tuple of all of the return values794 TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );795 // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false.796 ObjectDecl * newRet = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );797 deleteAll( retVals );798 retVals.clear();799 retVals.push_back( newRet );800 }801 }802 737 } // namespace SymTab 803 738 -
src/SynTree/ApplicationExpr.cc
r66f8528 r596f987b 30 30 if ( &other == this ) return *this; 31 31 decl = other.decl; 32 // xxx - this looks like a memory leak33 32 actualType = maybeClone( other.actualType ); 34 33 formalType = maybeClone( other.formalType ); -
src/SynTree/CompoundStmt.cc
r66f8528 r596f987b 49 49 Statement * origStmt = *origit++; 50 50 if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( s ) ) { 51 DeclStmt * origDeclStmt = safe_dynamic_cast< DeclStmt * >( origStmt ); 51 DeclStmt * origDeclStmt = dynamic_cast< DeclStmt * >( origStmt ); 52 assert( origDeclStmt ); 52 53 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * > ( declStmt->get_decl() ) ) { 53 DeclarationWithType * origdwt = safe_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() ); 54 DeclarationWithType * origdwt = dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() ); 55 assert( origdwt ); 54 56 assert( dwt->get_name() == origdwt->get_name() ); 55 57 declMap[ origdwt ] = dwt; 56 } else assert( ! dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() ) );57 } else assert( ! dynamic_cast< DeclStmt * > ( s ) );58 } 59 } 58 60 } 59 61 if ( ! declMap.empty() ) { -
src/SynTree/Declaration.h
r66f8528 r596f987b 180 180 public: 181 181 enum Kind { Any, Dtype, Ftype }; 182 /// Data extracted from a type decl183 struct Data {184 TypeDecl::Kind kind;185 bool isComplete;186 Data() : kind( (TypeDecl::Kind)-1 ), isComplete( false ) {}187 Data( TypeDecl * typeDecl ) : Data( typeDecl->get_kind(), typeDecl->isComplete() ) {}188 Data( Kind kind, bool isComplete ) : kind( kind ), isComplete( isComplete ) {}189 bool operator==(const Data & other) const { return kind == other.kind && isComplete == other.isComplete; }190 bool operator!=(const Data & other) const { return !(*this == other);}191 };192 182 193 183 TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ); … … 196 186 Kind get_kind() const { return kind; } 197 187 198 bool isComplete() const { return kind == Any || sized; }199 bool get_sized() const { return sized; }200 TypeDecl * set_sized( bool newValue ) { sized = newValue; return this; }201 202 188 virtual TypeDecl *clone() const { return new TypeDecl( *this ); } 203 189 virtual void accept( Visitor &v ) { v.visit( this ); } … … 206 192 virtual std::string typeString() const; 207 193 Kind kind; 208 bool sized;209 194 }; 210 195 … … 299 284 300 285 std::ostream & operator<<( std::ostream & out, const Declaration * decl ); 301 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data );302 286 303 287 #endif // DECLARATION_H -
src/SynTree/Expression.cc
r66f8528 r596f987b 332 332 } 333 333 334 namespace {335 TypeSubstitution makeSub( Type * t ) {336 if ( StructInstType * aggInst = dynamic_cast< StructInstType * >( t ) ) {337 return TypeSubstitution( aggInst->get_baseParameters()->begin(), aggInst->get_baseParameters()->end(), aggInst->get_parameters().begin() );338 } else if ( UnionInstType * aggInst = dynamic_cast< UnionInstType * >( t ) ) {339 return TypeSubstitution( aggInst->get_baseParameters()->begin(), aggInst->get_baseParameters()->end(), aggInst->get_parameters().begin() );340 } else {341 assertf( false, "makeSub expects struct or union type for aggregate" );342 }343 }344 }345 346 334 347 335 MemberExpr::MemberExpr( DeclarationWithType *_member, Expression *_aggregate, Expression *_aname ) : 348 336 Expression( _aname ), member(_member), aggregate(_aggregate) { 349 350 TypeSubstitution sub( makeSub( aggregate->get_result() ) ); 351 Type * res = member->get_type()->clone(); 352 sub.apply( res ); 353 set_result( res ); 337 set_result( member->get_type()->clone() ); 354 338 get_result()->set_isLvalue( true ); 355 339 } … … 527 511 528 512 ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() { 529 set_env( nullptr ); // ImplicitCopyCtorExpr does not take ownership of an environment530 513 delete callExpr; 531 514 deleteAll( tempDecls ); … … 537 520 os << "Implicit Copy Constructor Expression: " << std::endl; 538 521 assert( callExpr ); 539 os << std::string( indent+2, ' ' );540 522 callExpr->print( os, indent + 2 ); 541 523 os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl; … … 589 571 os << std::string( indent+2, ' ' ); 590 572 initializer->print( os, indent + 2 ); 591 Expression::print( os, indent );592 573 } 593 574 … … 609 590 os << " ... "; 610 591 high->print( os, indent ); 611 Expression::print( os, indent );612 592 } 613 593 … … 621 601 } 622 602 } 623 StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) { 624 cloneAll( other.returnDecls, returnDecls ); 625 cloneAll( other.dtors, dtors ); 626 } 603 StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) {} 627 604 StmtExpr::~StmtExpr() { 628 605 delete statements; 629 deleteAll( dtors );630 deleteAll( returnDecls );631 606 } 632 607 void StmtExpr::print( std::ostream &os, int indent ) const { 633 608 os << "Statement Expression: " << std::endl << std::string( indent, ' ' ); 634 609 statements->print( os, indent+2 ); 635 if ( ! returnDecls.empty() ) {636 os << std::string( indent+2, ' ' ) << "with returnDecls: ";637 printAll( returnDecls, os, indent+2 );638 }639 if ( ! dtors.empty() ) {640 os << std::string( indent+2, ' ' ) << "with dtors: ";641 printAll( dtors, os, indent+2 );642 }643 Expression::print( os, indent );644 610 } 645 611 … … 665 631 get_expr()->print( os, indent+2 ); 666 632 if ( get_object() ) { 667 os << std::string( indent+2, ' ' ) << "with decl: ";633 os << " with decl: "; 668 634 get_object()->printShort( os, indent+2 ); 669 635 } 670 Expression::print( os, indent );671 636 } 672 637 -
src/SynTree/Expression.h
r66f8528 r596f987b 543 543 544 544 std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; } 545 void set_tempDecls( std::list< ObjectDecl * > newValue ) { tempDecls = newValue; } 546 545 547 std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; } 548 void set_returnDecls( std::list< ObjectDecl * > newValue ) { returnDecls = newValue; } 549 546 550 std::list< Expression * > & get_dtors() { return dtors; } 551 void set_dtors( std::list< Expression * > newValue ) { dtors = newValue; } 547 552 548 553 virtual ImplicitCopyCtorExpr *clone() const { return new ImplicitCopyCtorExpr( *this ); } … … 701 706 virtual ~TupleAssignExpr(); 702 707 703 TupleAssignExpr * set_stmtExpr( StmtExpr * newValue ) { stmtExpr = newValue; return this; }704 StmtExpr * get_stmtExpr() const { return stmtExpr; }708 std::list< Expression * > & get_assigns() { return assigns; } 709 std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; } 705 710 706 711 virtual TupleAssignExpr *clone() const { return new TupleAssignExpr( *this ); } … … 709 714 virtual void print( std::ostream &os, int indent = 0 ) const; 710 715 private: 711 StmtExpr * stmtExpr = nullptr; 716 std::list< Expression * > assigns; // assignment expressions that use tempDecls 717 std::list< ObjectDecl * > tempDecls; // temporaries for address of lhs exprs 712 718 }; 713 719 … … 722 728 StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; } 723 729 724 std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }725 std::list< Expression * > & get_dtors() { return dtors; }726 727 730 virtual StmtExpr *clone() const { return new StmtExpr( *this ); } 728 731 virtual void accept( Visitor &v ) { v.visit( this ); } … … 731 734 private: 732 735 CompoundStmt * statements; 733 std::list< ObjectDecl * > returnDecls; // return variable(s) for stmt expression734 std::list< Expression * > dtors; // destructor(s) for return variable(s)735 736 }; 736 737 -
src/SynTree/Initializer.cc
r66f8528 r596f987b 65 65 } 66 66 67 ListInit::ListInit( const ListInit & other ) : Initializer( other ) {68 cloneAll( other.initializers, initializers );69 cloneAll( other.designators, designators );70 }71 72 73 67 ListInit::~ListInit() { 74 68 deleteAll( initializers ); -
src/SynTree/Initializer.h
r66f8528 r596f987b 88 88 ListInit( const std::list<Initializer*> &initializers, 89 89 const std::list<Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false ); 90 ListInit( const ListInit & other );91 90 virtual ~ListInit(); 92 91 -
src/SynTree/Mutator.cc
r66f8528 r596f987b 325 325 mutateAll( impCpCtorExpr->get_tempDecls(), *this ); 326 326 mutateAll( impCpCtorExpr->get_returnDecls(), *this ); 327 mutateAll( impCpCtorExpr->get_dtors(), *this );328 327 return impCpCtorExpr; 329 328 } … … 374 373 Expression *Mutator::mutate( TupleAssignExpr *assignExpr ) { 375 374 assignExpr->set_result( maybeMutate( assignExpr->get_result(), *this ) ); 376 assignExpr->set_stmtExpr( maybeMutate( assignExpr->get_stmtExpr(), *this ) ); 375 mutateAll( assignExpr->get_tempDecls(), *this ); 376 mutateAll( assignExpr->get_assigns(), *this ); 377 377 return assignExpr; 378 378 } … … 381 381 stmtExpr->set_result( maybeMutate( stmtExpr->get_result(), *this ) ); 382 382 stmtExpr->set_statements( maybeMutate( stmtExpr->get_statements(), *this ) ); 383 mutateAll( stmtExpr->get_returnDecls(), *this );384 mutateAll( stmtExpr->get_dtors(), *this );385 383 return stmtExpr; 386 384 } … … 505 503 Initializer *Mutator::mutate( ConstructorInit *ctorInit ) { 506 504 ctorInit->set_ctor( maybeMutate( ctorInit->get_ctor(), *this ) ); 507 ctorInit->set_dtor( maybeMutate( ctorInit->get_dtor(), *this ) );508 505 ctorInit->set_init( maybeMutate( ctorInit->get_init(), *this ) ); 509 506 return ctorInit; -
src/SynTree/ReferenceToType.cc
r66f8528 r596f987b 46 46 47 47 namespace { 48 void doLookup( const std::list< Declaration* > &members, const std::string &name, std::list< Declaration* > &foundDecls ) { 48 void doLookup( const std::list< Declaration* > &members, const std::list< TypeDecl* > &parms, const std::list< Expression* > &args, const std::string &name, std::list< Declaration* > &foundDecls ) { 49 std::list< Declaration* > found; 49 50 for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) { 50 51 if ( (*i)->get_name() == name ) { 51 found Decls.push_back( *i );52 found.push_back( *i ); 52 53 } // if 53 54 } // for 55 applySubstitution( parms.begin(), parms.end(), args.begin(), found.begin(), found.end(), back_inserter( foundDecls ) ); 54 56 } 55 57 } // namespace … … 66 68 void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { 67 69 assert( baseStruct ); 68 doLookup( baseStruct->get_members(), name, foundDecls );70 doLookup( baseStruct->get_members(), baseStruct->get_parameters(), parameters, name, foundDecls ); 69 71 } 70 72 … … 92 94 void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { 93 95 assert( baseUnion ); 94 doLookup( baseUnion->get_members(), name, foundDecls );96 doLookup( baseUnion->get_members(), baseUnion->get_parameters(), parameters, name, foundDecls ); 95 97 } 96 98 … … 128 130 } 129 131 130 TypeInstType::TypeInstType( const TypeInstType &other ) : Parent( other ), baseType( other.baseType ), isFtype( other.isFtype ) {131 }132 133 134 132 TypeInstType::~TypeInstType() { 135 133 // delete baseType; //This is shared and should not be deleted -
src/SynTree/TupleExpr.cc
r66f8528 r596f987b 87 87 } 88 88 89 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ) { 90 // convert internally into a StmtExpr which contains the declarations and produces the tuple of the assignments 89 90 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ), assigns( assigns ), tempDecls( tempDecls ) { 91 91 set_result( Tuples::makeTupleType( assigns ) ); 92 CompoundStmt * compoundStmt = new CompoundStmt( noLabels );93 std::list< Statement * > & stmts = compoundStmt->get_kids();94 for ( ObjectDecl * obj : tempDecls ) {95 stmts.push_back( new DeclStmt( noLabels, obj ) );96 }97 TupleExpr * tupleExpr = new TupleExpr( assigns );98 assert( tupleExpr->get_result() );99 stmts.push_back( new ExprStmt( noLabels, tupleExpr ) );100 stmtExpr = new StmtExpr( compoundStmt );101 92 } 102 93 103 94 TupleAssignExpr::TupleAssignExpr( const TupleAssignExpr &other ) : Expression( other ) { 104 assert( other.stmtExpr ); 105 stmtExpr = other.stmtExpr->clone(); 95 cloneAll( other.assigns, assigns ); 96 cloneAll( other.tempDecls, tempDecls ); 97 98 // clone needs to go into assigns and replace tempDecls 99 VarExprReplacer::DeclMap declMap; 100 std::list< ObjectDecl * >::const_iterator origit = other.tempDecls.begin(); 101 for ( ObjectDecl * temp : tempDecls ) { 102 assert( origit != other.tempDecls.end() ); 103 ObjectDecl * origTemp = *origit++; 104 assert( origTemp ); 105 assert( temp->get_name() == origTemp->get_name() ); 106 declMap[ origTemp ] = temp; 107 } 108 if ( ! declMap.empty() ) { 109 VarExprReplacer replacer( declMap ); 110 for ( Expression * assn : assigns ) { 111 assn->accept( replacer ); 112 } 113 } 106 114 } 107 115 108 116 TupleAssignExpr::~TupleAssignExpr() { 109 delete stmtExpr; 117 deleteAll( assigns ); 118 // deleteAll( tempDecls ); 110 119 } 111 120 112 121 void TupleAssignExpr::print( std::ostream &os, int indent ) const { 113 os << "Tuple Assignment Expression, with stmt expr:" << std::endl; 114 os << std::string( indent+2, ' ' ); 115 stmtExpr->print( os, indent+4 ); 122 os << "Tuple Assignment Expression, with temporaries:" << std::endl; 123 printAll( tempDecls, os, indent+4 ); 124 os << std::string( indent+2, ' ' ) << "with assignments: " << std::endl; 125 printAll( assigns, os, indent+4 ); 116 126 Expression::print( os, indent ); 117 127 } -
src/SynTree/Type.h
r66f8528 r596f987b 72 72 virtual unsigned size() const { return 1; }; 73 73 virtual bool isVoid() const { return size() == 0; } 74 virtual Type * getComponent( unsigned i ) { assertf( size() == 1 && i == 0, "Type::getComponent was called with size %d and index %d\n", size(), i ); return this; }75 74 76 75 virtual Type *clone() const = 0; … … 340 339 TypeInstType( const Type::Qualifiers &tq, const std::string &name, TypeDecl *baseType ); 341 340 TypeInstType( const Type::Qualifiers &tq, const std::string &name, bool isFtype ); 342 TypeInstType( const TypeInstType &other ) ;341 TypeInstType( const TypeInstType &other ) : Parent( other ), baseType( other.baseType ), isFtype( other.isFtype ) {} 343 342 ~TypeInstType(); 344 343 … … 374 373 iterator begin() { return types.begin(); } 375 374 iterator end() { return types.end(); } 376 377 virtual Type * getComponent( unsigned i ) {378 assertf( i < size(), "TupleType::getComponent: index %d must be less than size %d", i, size() );379 return *(begin()+i);380 }381 375 382 376 virtual TupleType *clone() const { return new TupleType( *this ); } -
src/SynTree/TypeDecl.cc
r66f8528 r596f987b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // TypeDecl.cc -- 7 // TypeDecl.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 18 18 #include "Common/utility.h" 19 19 20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ) , sized( kind == Any ){20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ) { 21 21 } 22 22 23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ) , sized( other.sized ){23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ) { 24 24 } 25 25 … … 29 29 } 30 30 31 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ) {32 return os << data.kind << ", " << data.isComplete;33 }34 35 31 // Local Variables: // 36 32 // tab-width: 4 // -
src/SynTree/VarExprReplacer.cc
r66f8528 r596f987b 21 21 // replace variable with new node from decl map 22 22 void VarExprReplacer::visit( VariableExpr * varExpr ) { 23 // xxx - assertions and parameters aren't accounted for in this... (i.e. they aren't inserted into the map when it's made, only DeclStmts are)24 23 if ( declMap.count( varExpr->get_var() ) ) { 25 24 varExpr->set_var( declMap.at( varExpr->get_var() ) ); -
src/SynTree/Visitor.cc
r66f8528 r596f987b 276 276 acceptAll( impCpCtorExpr->get_tempDecls(), *this ); 277 277 acceptAll( impCpCtorExpr->get_returnDecls(), *this ); 278 acceptAll( impCpCtorExpr->get_dtors(), *this );279 278 } 280 279 … … 318 317 void Visitor::visit( TupleAssignExpr *assignExpr ) { 319 318 maybeAccept( assignExpr->get_result(), *this ); 320 maybeAccept( assignExpr->get_stmtExpr(), *this ); 319 acceptAll( assignExpr->get_tempDecls(), *this ); 320 acceptAll( assignExpr->get_assigns(), *this ); 321 321 } 322 322 … … 324 324 maybeAccept( stmtExpr->get_result(), *this ); 325 325 maybeAccept( stmtExpr->get_statements(), *this ); 326 acceptAll( stmtExpr->get_returnDecls(), *this );327 acceptAll( stmtExpr->get_dtors(), *this );328 326 } 329 327 … … 427 425 void Visitor::visit( ConstructorInit *ctorInit ) { 428 426 maybeAccept( ctorInit->get_ctor(), *this ); 429 maybeAccept( ctorInit->get_dtor(), *this );430 427 maybeAccept( ctorInit->get_init(), *this ); 431 428 } -
src/Tuples/Explode.cc
r66f8528 r596f987b 23 23 Expression * applyAddr( Expression * expr, bool first = true ) { 24 24 if ( TupleExpr * tupleExpr = dynamic_cast< TupleExpr * >( expr ) ){ 25 foundUniqueExpr = true;26 25 std::list< Expression * > exprs; 27 26 for ( Expression *& expr : tupleExpr->get_exprs() ) { … … 47 46 // should now be a tuple of addresses rather than the address of a tuple. 48 47 // Still, this code is a bit awkward, and could use some improvement. 49 if ( dynamic_cast< AddressExpr * > ( uniqueExpr->get_expr() ) ) { 50 // this unique expression has already been mutated or otherwise shouldn't be (can't take the address-of an address-of expression) 51 return uniqueExpr; 52 } 48 foundUniqueExpr = true; 53 49 UniqueExpr * newUniqueExpr = new UniqueExpr( applyAddr( uniqueExpr->get_expr() ), uniqueExpr->get_id() ); 54 50 delete uniqueExpr; -
src/Tuples/TupleAssignment.cc
r66f8528 r596f987b 23 23 #include "Common/SemanticError.h" 24 24 #include "InitTweak/InitTweak.h" 25 #include "InitTweak/GenInit.h"26 25 27 26 #include <functional> … … 48 47 virtual ~Matcher() {} 49 48 virtual void match( std::list< Expression * > &out ) = 0; 50 ObjectDecl * newObject( UniqueName & namer, Expression * expr );51 49 ResolvExpr::AltList lhs, rhs; 52 50 TupleAssignSpotter &spotter; 53 ResolvExpr::Cost baseCost;54 51 std::list< ObjectDecl * > tmpDecls; 55 ResolvExpr::TypeEnvironment compositeEnv;56 52 }; 57 53 … … 150 146 finder.findWithAdjustment(*i); 151 147 } catch (...) { 152 return; // no match should not mean failure, it just means this particular tuple assignment isn't valid148 return; // xxx - no match should not mean failure, it just means this particular tuple assignment isn't valid 153 149 } 154 150 // prune expressions that don't coincide with … … 165 161 solved_assigns.push_back( alt.expr->clone() ); 166 162 } 167 // combine assignment environments into combined expression environment 168 simpleCombineEnvironments( current.begin(), current.end(), matcher->compositeEnv ); 169 currentFinder.get_alternatives().push_front( ResolvExpr::Alternative(new TupleAssignExpr(solved_assigns, matcher->tmpDecls), matcher->compositeEnv, ResolvExpr::sumCost( current ) + matcher->baseCost ) ); 170 } 171 172 TupleAssignSpotter::Matcher::Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList &alts ) : spotter(spotter), baseCost( ResolvExpr::sumCost( alts ) ) { 163 // xxx - need to do this?? 164 ResolvExpr::TypeEnvironment compositeEnv; 165 simpleCombineEnvironments( current.begin(), current.end(), compositeEnv ); 166 currentFinder.get_alternatives().push_front( ResolvExpr::Alternative(new TupleAssignExpr(solved_assigns, matcher->tmpDecls), compositeEnv, ResolvExpr::sumCost( current ) ) ); 167 } 168 169 TupleAssignSpotter::Matcher::Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList &alts ) : spotter(spotter) { 173 170 assert( ! alts.empty() ); 174 // combine argument environments into combined expression environment175 simpleCombineEnvironments( alts.begin(), alts.end(), compositeEnv );176 177 171 ResolvExpr::Alternative lhsAlt = alts.front(); 178 172 // peel off the cast that exists on ctor/dtor expressions … … 223 217 } 224 218 225 // removes environments from subexpressions within statement exprs, which could throw off later passes like those in Box which rely on PolyMutator. 226 // xxx - maybe this should happen in alternative finder for every StmtExpr? 227 // xxx - it's possible that these environments could contain some useful information. Maybe the right thing to do is aggregate the environments and pass the aggregate back to be added into the compositeEnv 228 struct EnvRemover : public Visitor { 229 virtual void visit( ExprStmt * stmt ) { 230 delete stmt->get_expr()->get_env(); 231 stmt->get_expr()->set_env( nullptr ); 232 Visitor::visit( stmt ); 233 } 234 }; 235 236 ObjectDecl * TupleAssignSpotter::Matcher::newObject( UniqueName & namer, Expression * expr ) { 219 ObjectDecl * newObject( UniqueName & namer, Expression * expr ) { 237 220 assert( expr->has_result() && ! expr->get_result()->isVoid() ); 238 ObjectDecl * ret = new ObjectDecl( namer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) ); 239 ConstructorInit * ctorInit = InitTweak::genCtorInit( ret ); 240 ret->set_init( ctorInit ); 241 ResolvExpr::resolveCtorInit( ctorInit, spotter.currentFinder.get_indexer() ); // resolve ctor/dtors for the new object 242 EnvRemover rm; // remove environments from subexpressions of StmtExprs 243 ctorInit->accept( rm ); 244 return ret; 221 return new ObjectDecl( namer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) ); 245 222 } 246 223 … … 267 244 std::list< ObjectDecl * > ltmp; 268 245 std::list< ObjectDecl * > rtmp; 269 std::transform( lhs.begin(), lhs.end(), back_inserter( ltmp ), [ &]( ResolvExpr::Alternative & alt ){246 std::transform( lhs.begin(), lhs.end(), back_inserter( ltmp ), []( ResolvExpr::Alternative & alt ){ 270 247 return newObject( lhsNamer, alt.expr ); 271 248 }); 272 std::transform( rhs.begin(), rhs.end(), back_inserter( rtmp ), [ &]( ResolvExpr::Alternative & alt ){249 std::transform( rhs.begin(), rhs.end(), back_inserter( rtmp ), []( ResolvExpr::Alternative & alt ){ 273 250 return newObject( rhsNamer, alt.expr ); 274 251 }); -
src/Tuples/TupleExpansion.cc
r66f8528 r596f987b 93 93 typedef Mutator Parent; 94 94 using Parent::mutate; 95 95 96 96 virtual Expression * mutate( TupleExpr * tupleExpr ) override; 97 97 }; … … 194 194 new CommaExpr( new CommaExpr( assignUnq, assignFinished ), var->clone() ) ); 195 195 condExpr->set_result( var->get_result()->clone() ); 196 condExpr->set_env( maybeClone( unqExpr->get_env() ) );197 196 decls[id] = condExpr; 198 197 } … … 203 202 Expression * TupleAssignExpander::mutate( TupleAssignExpr * assnExpr ) { 204 203 assnExpr = safe_dynamic_cast< TupleAssignExpr * >( Parent::mutate( assnExpr ) ); 205 StmtExpr * ret = assnExpr->get_stmtExpr(); 206 assnExpr->set_stmtExpr( nullptr ); 207 // move env to StmtExpr 208 ret->set_env( assnExpr->get_env() ); 209 assnExpr->set_env( nullptr ); 204 CompoundStmt * compoundStmt = new CompoundStmt( noLabels ); 205 std::list< Statement * > & stmts = compoundStmt->get_kids(); 206 for ( ObjectDecl * obj : assnExpr->get_tempDecls() ) { 207 stmts.push_back( new DeclStmt( noLabels, obj ) ); 208 } 209 TupleExpr * tupleExpr = new TupleExpr( assnExpr->get_assigns() ); 210 assert( tupleExpr->get_result() ); 211 stmts.push_back( new ExprStmt( noLabels, tupleExpr ) ); 212 assnExpr->get_tempDecls().clear(); 213 assnExpr->get_assigns().clear(); 210 214 delete assnExpr; 211 return ret;215 return new StmtExpr( compoundStmt ); 212 216 } 213 217 214 218 Type * TupleTypeReplacer::mutate( TupleType * tupleType ) { 215 219 std::string mangleName = SymTab::Mangler::mangleType( tupleType ); 216 tupleType = safe_dynamic_cast< TupleType * > ( Parent::mutate( tupleType ) );220 TupleType * newType = safe_dynamic_cast< TupleType * > ( Parent::mutate( tupleType ) ); 217 221 if ( ! typeMap.count( mangleName ) ) { 218 222 // generate struct type to replace tuple type 219 // xxx - should fix this to only generate one tuple struct for each number of type parameters220 223 StructDecl * decl = new StructDecl( "_tuple_type_" + mangleName ); 221 224 decl->set_body( true ); 222 for ( size_t i = 0; i < tupleType->size(); ++i ) { 223 TypeDecl * tyParam = new TypeDecl( toString("tuple_param_", i), DeclarationNode::NoStorageClass, nullptr, TypeDecl::Any ); 224 decl->get_members().push_back( new ObjectDecl( toString("field_", i), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new TypeInstType( Type::Qualifiers(), tyParam->get_name(), tyParam ), nullptr ) ); 225 decl->get_parameters().push_back( tyParam ); 225 int cnt = 0; 226 for ( Type * t : *newType ) { 227 decl->get_members().push_back( new ObjectDecl( toString("field_", cnt++), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, t->clone(), nullptr ) ); 226 228 } 227 229 typeMap[mangleName] = decl; 228 230 addDeclaration( decl ); 229 231 } 230 Type::Qualifiers qualifiers = tupleType->get_qualifiers(); 231 232 StructDecl * decl = typeMap[mangleName]; 233 StructInstType * newType = new StructInstType( qualifiers, decl ); 234 for ( Type * t : *tupleType ) { 235 newType->get_parameters().push_back( new TypeExpr( t->clone() ) ); 236 } 237 delete tupleType; 238 return newType; 232 Type::Qualifiers qualifiers = newType->get_qualifiers(); 233 delete newType; 234 return new StructInstType( qualifiers, typeMap[mangleName] ); 239 235 } 240 236 … … 244 240 tupleExpr->set_tuple( nullptr ); 245 241 unsigned int idx = tupleExpr->get_index(); 246 TypeSubstitution * env = tupleExpr->get_env();247 tupleExpr->set_env( nullptr );248 242 delete tupleExpr; 249 243 … … 252 246 assert( structDecl->get_members().size() > idx ); 253 247 Declaration * member = *std::next(structDecl->get_members().begin(), idx); 254 MemberExpr * memExpr = new MemberExpr( safe_dynamic_cast< DeclarationWithType * >( member ), tuple ); 255 memExpr->set_env( env ); 256 return memExpr; 257 } 258 259 Expression * replaceTupleExpr( Type * result, const std::list< Expression * > & exprs, TypeSubstitution * env ) { 248 return new MemberExpr( safe_dynamic_cast< DeclarationWithType * >( member ), tuple ); 249 } 250 251 Expression * replaceTupleExpr( Type * result, const std::list< Expression * > & exprs ) { 260 252 if ( result->isVoid() ) { 261 253 // void result - don't need to produce a value for cascading - just output a chain of comma exprs 262 254 assert( ! exprs.empty() ); 263 255 std::list< Expression * >::const_iterator iter = exprs.begin(); 264 Expression * expr = new CastExpr( *iter++ );256 Expression * expr = *iter++; 265 257 for ( ; iter != exprs.end(); ++iter ) { 266 expr = new CommaExpr( expr, new CastExpr( *iter ) ); 267 } 268 expr->set_env( env ); 258 expr = new CommaExpr( expr, *iter ); 259 } 269 260 return expr; 270 261 } else { … … 276 267 inits.push_back( new SingleInit( expr ) ); 277 268 } 278 Expression * expr = new CompoundLiteralExpr( result, new ListInit( inits ) ); 279 expr->set_env( env ); 280 return expr; 269 return new CompoundLiteralExpr( result, new ListInit( inits ) ); 281 270 } 282 271 } … … 288 277 std::list< Expression * > exprs = tupleExpr->get_exprs(); 289 278 assert( result ); 290 TypeSubstitution * env = tupleExpr->get_env();291 279 292 280 // remove data from shell and delete it 293 281 tupleExpr->set_result( nullptr ); 294 282 tupleExpr->get_exprs().clear(); 295 tupleExpr->set_env( nullptr );296 283 delete tupleExpr; 297 284 298 return replaceTupleExpr( result, exprs , env);285 return replaceTupleExpr( result, exprs ); 299 286 } 300 287 -
src/main.cc
r66f8528 r596f987b 266 266 OPTPRINT( "expandUniqueExpr" ); // xxx - is this the right place for this? want to expand ASAP so that subsequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused 267 267 Tuples::expandUniqueExpr( translationUnit ); 268 OPTPRINT( "expandTuples" ); // xxx - is this the right place for this?269 Tuples::expandTuples( translationUnit );270 268 271 269 OPTPRINT("instantiateGenerics") … … 284 282 OPTPRINT( "box" ) 285 283 GenPoly::box( translationUnit ); 284 OPTPRINT( "expandTuples" ); // xxx - is this the right place for this? 285 Tuples::expandTuples( translationUnit ); 286 286 287 287 // print tree right before code generation -
src/prelude/prelude.cf
r66f8528 r596f987b 105 105 forall( otype T ) const volatile T * --?( const volatile T ** ); 106 106 107 forall( dtype T | sized(T)) lvalue T *?( T * );108 forall( dtype T | sized(T)) const lvalue T *?( const T * );109 forall( dtype T | sized(T)) volatile lvalue T *?( volatile T * );110 forall( dtype T | sized(T)) const volatile lvalue T *?( const volatile T * );107 forall( otype T ) lvalue T *?( T * ); 108 forall( otype T ) const lvalue T *?( const T * ); 109 forall( otype T ) volatile lvalue T *?( volatile T * ); 110 forall( otype T ) const volatile lvalue T *?( const volatile T * ); 111 111 forall( ftype FT ) lvalue FT *?( FT * ); 112 112 -
src/tests/.expect/32/declarationSpecifier.txt
r66f8528 r596f987b 20 20 static inline void ___constructor__F_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1); 21 21 static inline void ___destructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1); 22 static inline void ___constructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1){23 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))) /* ?{} */);24 }25 static inline void ___constructor__F_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){26 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))=___src__13s__anonymous0_1.__i__i_1) /* ?{} */);27 }28 static inline void ___destructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1){29 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))) /* ^?{} */);30 }31 22 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 32 23 ((void)((*___dst__P13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1)); 33 24 return ((struct __anonymous0 )___src__13s__anonymous0_1); 25 } 26 static inline void ___constructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1){ 27 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))) /* ?{} */); 28 } 29 static inline void ___constructor__F_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 30 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))=___src__13s__anonymous0_1.__i__i_1) /* ?{} */); 31 } 32 static inline void ___destructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1){ 33 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))) /* ^?{} */); 34 34 } 35 35 static inline void ___constructor__F_P13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, int __i__i_1){ … … 44 44 static inline void ___constructor__F_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1); 45 45 static inline void ___destructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1); 46 static inline void ___constructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1){47 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))) /* ?{} */);48 }49 static inline void ___constructor__F_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){50 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))=___src__13s__anonymous1_1.__i__i_1) /* ?{} */);51 }52 static inline void ___destructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1){53 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))) /* ^?{} */);54 }55 46 static inline struct __anonymous1 ___operator_assign__F13s__anonymous1_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){ 56 47 ((void)((*___dst__P13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1)); 57 48 return ((struct __anonymous1 )___src__13s__anonymous1_1); 49 } 50 static inline void ___constructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1){ 51 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))) /* ?{} */); 52 } 53 static inline void ___constructor__F_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){ 54 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))=___src__13s__anonymous1_1.__i__i_1) /* ?{} */); 55 } 56 static inline void ___destructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1){ 57 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))) /* ^?{} */); 58 58 } 59 59 static inline void ___constructor__F_P13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, int __i__i_1){ … … 68 68 static inline void ___constructor__F_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1); 69 69 static inline void ___destructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1); 70 static inline void ___constructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1){71 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))) /* ?{} */);72 }73 static inline void ___constructor__F_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){74 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))=___src__13s__anonymous2_1.__i__i_1) /* ?{} */);75 }76 static inline void ___destructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1){77 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))) /* ^?{} */);78 }79 70 static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 80 71 ((void)((*___dst__P13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1)); 81 72 return ((struct __anonymous2 )___src__13s__anonymous2_1); 73 } 74 static inline void ___constructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1){ 75 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))) /* ?{} */); 76 } 77 static inline void ___constructor__F_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 78 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))=___src__13s__anonymous2_1.__i__i_1) /* ?{} */); 79 } 80 static inline void ___destructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1){ 81 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))) /* ^?{} */); 82 82 } 83 83 static inline void ___constructor__F_P13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, int __i__i_1){ … … 92 92 static inline void ___constructor__F_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1); 93 93 static inline void ___destructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1); 94 static inline void ___constructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1){95 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))) /* ?{} */);96 }97 static inline void ___constructor__F_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){98 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))=___src__13s__anonymous3_1.__i__i_1) /* ?{} */);99 }100 static inline void ___destructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1){101 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))) /* ^?{} */);102 }103 94 static inline struct __anonymous3 ___operator_assign__F13s__anonymous3_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){ 104 95 ((void)((*___dst__P13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1)); 105 96 return ((struct __anonymous3 )___src__13s__anonymous3_1); 97 } 98 static inline void ___constructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1){ 99 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))) /* ?{} */); 100 } 101 static inline void ___constructor__F_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){ 102 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))=___src__13s__anonymous3_1.__i__i_1) /* ?{} */); 103 } 104 static inline void ___destructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1){ 105 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))) /* ^?{} */); 106 106 } 107 107 static inline void ___constructor__F_P13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, int __i__i_1){ … … 116 116 static inline void ___constructor__F_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1); 117 117 static inline void ___destructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1); 118 static inline void ___constructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1){119 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))) /* ?{} */);120 }121 static inline void ___constructor__F_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){122 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))=___src__13s__anonymous4_1.__i__i_1) /* ?{} */);123 }124 static inline void ___destructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1){125 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))) /* ^?{} */);126 }127 118 static inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){ 128 119 ((void)((*___dst__P13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1)); 129 120 return ((struct __anonymous4 )___src__13s__anonymous4_1); 121 } 122 static inline void ___constructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1){ 123 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))) /* ?{} */); 124 } 125 static inline void ___constructor__F_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){ 126 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))=___src__13s__anonymous4_1.__i__i_1) /* ?{} */); 127 } 128 static inline void ___destructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1){ 129 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))) /* ^?{} */); 130 130 } 131 131 static inline void ___constructor__F_P13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, int __i__i_1){ … … 140 140 static inline void ___constructor__F_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1); 141 141 static inline void ___destructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1); 142 static inline void ___constructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1){143 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))) /* ?{} */);144 }145 static inline void ___constructor__F_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){146 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))=___src__13s__anonymous5_1.__i__i_1) /* ?{} */);147 }148 static inline void ___destructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1){149 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))) /* ^?{} */);150 }151 142 static inline struct __anonymous5 ___operator_assign__F13s__anonymous5_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){ 152 143 ((void)((*___dst__P13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1)); 153 144 return ((struct __anonymous5 )___src__13s__anonymous5_1); 145 } 146 static inline void ___constructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1){ 147 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))) /* ?{} */); 148 } 149 static inline void ___constructor__F_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){ 150 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))=___src__13s__anonymous5_1.__i__i_1) /* ?{} */); 151 } 152 static inline void ___destructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1){ 153 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))) /* ^?{} */); 154 154 } 155 155 static inline void ___constructor__F_P13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, int __i__i_1){ … … 164 164 static inline void ___constructor__F_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1); 165 165 static inline void ___destructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1); 166 static inline void ___constructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1){167 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))) /* ?{} */);168 }169 static inline void ___constructor__F_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){170 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))=___src__13s__anonymous6_1.__i__i_1) /* ?{} */);171 }172 static inline void ___destructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1){173 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))) /* ^?{} */);174 }175 166 static inline struct __anonymous6 ___operator_assign__F13s__anonymous6_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){ 176 167 ((void)((*___dst__P13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1)); 177 168 return ((struct __anonymous6 )___src__13s__anonymous6_1); 169 } 170 static inline void ___constructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1){ 171 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))) /* ?{} */); 172 } 173 static inline void ___constructor__F_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){ 174 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))=___src__13s__anonymous6_1.__i__i_1) /* ?{} */); 175 } 176 static inline void ___destructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1){ 177 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))) /* ^?{} */); 178 178 } 179 179 static inline void ___constructor__F_P13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, int __i__i_1){ … … 188 188 static inline void ___constructor__F_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1); 189 189 static inline void ___destructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1); 190 static inline void ___constructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1){191 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))) /* ?{} */);192 }193 static inline void ___constructor__F_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){194 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))=___src__13s__anonymous7_1.__i__i_1) /* ?{} */);195 }196 static inline void ___destructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1){197 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))) /* ^?{} */);198 }199 190 static inline struct __anonymous7 ___operator_assign__F13s__anonymous7_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){ 200 191 ((void)((*___dst__P13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1)); 201 192 return ((struct __anonymous7 )___src__13s__anonymous7_1); 193 } 194 static inline void ___constructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1){ 195 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))) /* ?{} */); 196 } 197 static inline void ___constructor__F_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){ 198 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))=___src__13s__anonymous7_1.__i__i_1) /* ?{} */); 199 } 200 static inline void ___destructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1){ 201 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))) /* ^?{} */); 202 202 } 203 203 static inline void ___constructor__F_P13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, int __i__i_1){ … … 220 220 static inline void ___constructor__F_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1); 221 221 static inline void ___destructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1); 222 static inline void ___constructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1){223 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))) /* ?{} */);224 }225 static inline void ___constructor__F_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){226 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))=___src__13s__anonymous8_1.__i__s_1) /* ?{} */);227 }228 static inline void ___destructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1){229 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))) /* ^?{} */);230 }231 222 static inline struct __anonymous8 ___operator_assign__F13s__anonymous8_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){ 232 223 ((void)((*___dst__P13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1)); 233 224 return ((struct __anonymous8 )___src__13s__anonymous8_1); 225 } 226 static inline void ___constructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1){ 227 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))) /* ?{} */); 228 } 229 static inline void ___constructor__F_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){ 230 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))=___src__13s__anonymous8_1.__i__s_1) /* ?{} */); 231 } 232 static inline void ___destructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1){ 233 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))) /* ^?{} */); 234 234 } 235 235 static inline void ___constructor__F_P13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, short __i__s_1){ … … 244 244 static inline void ___constructor__F_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1); 245 245 static inline void ___destructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1); 246 static inline void ___constructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1){247 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))) /* ?{} */);248 }249 static inline void ___constructor__F_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){250 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))=___src__13s__anonymous9_1.__i__s_1) /* ?{} */);251 }252 static inline void ___destructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1){253 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))) /* ^?{} */);254 }255 246 static inline struct __anonymous9 ___operator_assign__F13s__anonymous9_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){ 256 247 ((void)((*___dst__P13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1)); 257 248 return ((struct __anonymous9 )___src__13s__anonymous9_1); 249 } 250 static inline void ___constructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1){ 251 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))) /* ?{} */); 252 } 253 static inline void ___constructor__F_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){ 254 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))=___src__13s__anonymous9_1.__i__s_1) /* ?{} */); 255 } 256 static inline void ___destructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1){ 257 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))) /* ^?{} */); 258 258 } 259 259 static inline void ___constructor__F_P13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, short __i__s_1){ … … 268 268 static inline void ___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1); 269 269 static inline void ___destructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1); 270 static inline void ___constructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1){271 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))) /* ?{} */);272 }273 static inline void ___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){274 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))=___src__14s__anonymous10_1.__i__s_1) /* ?{} */);275 }276 static inline void ___destructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1){277 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))) /* ^?{} */);278 }279 270 static inline struct __anonymous10 ___operator_assign__F14s__anonymous10_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){ 280 271 ((void)((*___dst__P14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1)); 281 272 return ((struct __anonymous10 )___src__14s__anonymous10_1); 273 } 274 static inline void ___constructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1){ 275 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))) /* ?{} */); 276 } 277 static inline void ___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){ 278 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))=___src__14s__anonymous10_1.__i__s_1) /* ?{} */); 279 } 280 static inline void ___destructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1){ 281 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))) /* ^?{} */); 282 282 } 283 283 static inline void ___constructor__F_P14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, short __i__s_1){ … … 292 292 static inline void ___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1); 293 293 static inline void ___destructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1); 294 static inline void ___constructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1){295 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))) /* ?{} */);296 }297 static inline void ___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){298 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))=___src__14s__anonymous11_1.__i__s_1) /* ?{} */);299 }300 static inline void ___destructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1){301 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))) /* ^?{} */);302 }303 294 static inline struct __anonymous11 ___operator_assign__F14s__anonymous11_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){ 304 295 ((void)((*___dst__P14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1)); 305 296 return ((struct __anonymous11 )___src__14s__anonymous11_1); 297 } 298 static inline void ___constructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1){ 299 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))) /* ?{} */); 300 } 301 static inline void ___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){ 302 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))=___src__14s__anonymous11_1.__i__s_1) /* ?{} */); 303 } 304 static inline void ___destructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1){ 305 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))) /* ^?{} */); 306 306 } 307 307 static inline void ___constructor__F_P14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, short __i__s_1){ … … 316 316 static inline void ___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1); 317 317 static inline void ___destructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1); 318 static inline void ___constructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1){319 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))) /* ?{} */);320 }321 static inline void ___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){322 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))=___src__14s__anonymous12_1.__i__s_1) /* ?{} */);323 }324 static inline void ___destructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1){325 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))) /* ^?{} */);326 }327 318 static inline struct __anonymous12 ___operator_assign__F14s__anonymous12_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){ 328 319 ((void)((*___dst__P14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1)); 329 320 return ((struct __anonymous12 )___src__14s__anonymous12_1); 321 } 322 static inline void ___constructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1){ 323 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))) /* ?{} */); 324 } 325 static inline void ___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){ 326 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))=___src__14s__anonymous12_1.__i__s_1) /* ?{} */); 327 } 328 static inline void ___destructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1){ 329 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))) /* ^?{} */); 330 330 } 331 331 static inline void ___constructor__F_P14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, short __i__s_1){ … … 340 340 static inline void ___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1); 341 341 static inline void ___destructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1); 342 static inline void ___constructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1){343 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))) /* ?{} */);344 }345 static inline void ___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){346 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))=___src__14s__anonymous13_1.__i__s_1) /* ?{} */);347 }348 static inline void ___destructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1){349 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))) /* ^?{} */);350 }351 342 static inline struct __anonymous13 ___operator_assign__F14s__anonymous13_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){ 352 343 ((void)((*___dst__P14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1)); 353 344 return ((struct __anonymous13 )___src__14s__anonymous13_1); 345 } 346 static inline void ___constructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1){ 347 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))) /* ?{} */); 348 } 349 static inline void ___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){ 350 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))=___src__14s__anonymous13_1.__i__s_1) /* ?{} */); 351 } 352 static inline void ___destructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1){ 353 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))) /* ^?{} */); 354 354 } 355 355 static inline void ___constructor__F_P14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, short __i__s_1){ … … 364 364 static inline void ___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1); 365 365 static inline void ___destructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1); 366 static inline void ___constructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1){367 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))) /* ?{} */);368 }369 static inline void ___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){370 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))=___src__14s__anonymous14_1.__i__s_1) /* ?{} */);371 }372 static inline void ___destructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1){373 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))) /* ^?{} */);374 }375 366 static inline struct __anonymous14 ___operator_assign__F14s__anonymous14_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){ 376 367 ((void)((*___dst__P14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1)); 377 368 return ((struct __anonymous14 )___src__14s__anonymous14_1); 369 } 370 static inline void ___constructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1){ 371 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))) /* ?{} */); 372 } 373 static inline void ___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){ 374 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))=___src__14s__anonymous14_1.__i__s_1) /* ?{} */); 375 } 376 static inline void ___destructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1){ 377 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))) /* ^?{} */); 378 378 } 379 379 static inline void ___constructor__F_P14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, short __i__s_1){ … … 388 388 static inline void ___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1); 389 389 static inline void ___destructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1); 390 static inline void ___constructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1){391 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))) /* ?{} */);392 }393 static inline void ___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){394 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))=___src__14s__anonymous15_1.__i__s_1) /* ?{} */);395 }396 static inline void ___destructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1){397 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))) /* ^?{} */);398 }399 390 static inline struct __anonymous15 ___operator_assign__F14s__anonymous15_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){ 400 391 ((void)((*___dst__P14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1)); 401 392 return ((struct __anonymous15 )___src__14s__anonymous15_1); 393 } 394 static inline void ___constructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1){ 395 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))) /* ?{} */); 396 } 397 static inline void ___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){ 398 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))=___src__14s__anonymous15_1.__i__s_1) /* ?{} */); 399 } 400 static inline void ___destructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1){ 401 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))) /* ^?{} */); 402 402 } 403 403 static inline void ___constructor__F_P14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, short __i__s_1){ … … 428 428 static inline void ___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1); 429 429 static inline void ___destructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1); 430 static inline void ___constructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1){431 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))) /* ?{} */);432 }433 static inline void ___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){434 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))=___src__14s__anonymous16_1.__i__i_1) /* ?{} */);435 }436 static inline void ___destructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1){437 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))) /* ^?{} */);438 }439 430 static inline struct __anonymous16 ___operator_assign__F14s__anonymous16_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){ 440 431 ((void)((*___dst__P14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1)); 441 432 return ((struct __anonymous16 )___src__14s__anonymous16_1); 433 } 434 static inline void ___constructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1){ 435 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))) /* ?{} */); 436 } 437 static inline void ___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){ 438 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))=___src__14s__anonymous16_1.__i__i_1) /* ?{} */); 439 } 440 static inline void ___destructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1){ 441 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))) /* ^?{} */); 442 442 } 443 443 static inline void ___constructor__F_P14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, int __i__i_1){ … … 452 452 static inline void ___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1); 453 453 static inline void ___destructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1); 454 static inline void ___constructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1){455 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))) /* ?{} */);456 }457 static inline void ___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){458 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))=___src__14s__anonymous17_1.__i__i_1) /* ?{} */);459 }460 static inline void ___destructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1){461 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))) /* ^?{} */);462 }463 454 static inline struct __anonymous17 ___operator_assign__F14s__anonymous17_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){ 464 455 ((void)((*___dst__P14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1)); 465 456 return ((struct __anonymous17 )___src__14s__anonymous17_1); 457 } 458 static inline void ___constructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1){ 459 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))) /* ?{} */); 460 } 461 static inline void ___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){ 462 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))=___src__14s__anonymous17_1.__i__i_1) /* ?{} */); 463 } 464 static inline void ___destructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1){ 465 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))) /* ^?{} */); 466 466 } 467 467 static inline void ___constructor__F_P14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, int __i__i_1){ … … 476 476 static inline void ___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1); 477 477 static inline void ___destructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1); 478 static inline void ___constructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1){479 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))) /* ?{} */);480 }481 static inline void ___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){482 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))=___src__14s__anonymous18_1.__i__i_1) /* ?{} */);483 }484 static inline void ___destructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1){485 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))) /* ^?{} */);486 }487 478 static inline struct __anonymous18 ___operator_assign__F14s__anonymous18_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){ 488 479 ((void)((*___dst__P14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1)); 489 480 return ((struct __anonymous18 )___src__14s__anonymous18_1); 481 } 482 static inline void ___constructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1){ 483 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))) /* ?{} */); 484 } 485 static inline void ___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){ 486 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))=___src__14s__anonymous18_1.__i__i_1) /* ?{} */); 487 } 488 static inline void ___destructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1){ 489 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))) /* ^?{} */); 490 490 } 491 491 static inline void ___constructor__F_P14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, int __i__i_1){ … … 500 500 static inline void ___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1); 501 501 static inline void ___destructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1); 502 static inline void ___constructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1){503 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))) /* ?{} */);504 }505 static inline void ___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){506 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))=___src__14s__anonymous19_1.__i__i_1) /* ?{} */);507 }508 static inline void ___destructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1){509 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))) /* ^?{} */);510 }511 502 static inline struct __anonymous19 ___operator_assign__F14s__anonymous19_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){ 512 503 ((void)((*___dst__P14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1)); 513 504 return ((struct __anonymous19 )___src__14s__anonymous19_1); 505 } 506 static inline void ___constructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1){ 507 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))) /* ?{} */); 508 } 509 static inline void ___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){ 510 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))=___src__14s__anonymous19_1.__i__i_1) /* ?{} */); 511 } 512 static inline void ___destructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1){ 513 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))) /* ^?{} */); 514 514 } 515 515 static inline void ___constructor__F_P14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, int __i__i_1){ … … 524 524 static inline void ___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1); 525 525 static inline void ___destructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1); 526 static inline void ___constructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1){527 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))) /* ?{} */);528 }529 static inline void ___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){530 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))=___src__14s__anonymous20_1.__i__i_1) /* ?{} */);531 }532 static inline void ___destructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1){533 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))) /* ^?{} */);534 }535 526 static inline struct __anonymous20 ___operator_assign__F14s__anonymous20_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){ 536 527 ((void)((*___dst__P14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1)); 537 528 return ((struct __anonymous20 )___src__14s__anonymous20_1); 529 } 530 static inline void ___constructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1){ 531 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))) /* ?{} */); 532 } 533 static inline void ___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){ 534 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))=___src__14s__anonymous20_1.__i__i_1) /* ?{} */); 535 } 536 static inline void ___destructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1){ 537 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))) /* ^?{} */); 538 538 } 539 539 static inline void ___constructor__F_P14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, int __i__i_1){ … … 548 548 static inline void ___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1); 549 549 static inline void ___destructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1); 550 static inline void ___constructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1){551 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))) /* ?{} */);552 }553 static inline void ___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){554 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))=___src__14s__anonymous21_1.__i__i_1) /* ?{} */);555 }556 static inline void ___destructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1){557 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))) /* ^?{} */);558 }559 550 static inline struct __anonymous21 ___operator_assign__F14s__anonymous21_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){ 560 551 ((void)((*___dst__P14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1)); 561 552 return ((struct __anonymous21 )___src__14s__anonymous21_1); 553 } 554 static inline void ___constructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1){ 555 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))) /* ?{} */); 556 } 557 static inline void ___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){ 558 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))=___src__14s__anonymous21_1.__i__i_1) /* ?{} */); 559 } 560 static inline void ___destructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1){ 561 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))) /* ^?{} */); 562 562 } 563 563 static inline void ___constructor__F_P14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, int __i__i_1){ … … 572 572 static inline void ___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1); 573 573 static inline void ___destructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1); 574 static inline void ___constructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1){575 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))) /* ?{} */);576 }577 static inline void ___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){578 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))=___src__14s__anonymous22_1.__i__i_1) /* ?{} */);579 }580 static inline void ___destructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1){581 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))) /* ^?{} */);582 }583 574 static inline struct __anonymous22 ___operator_assign__F14s__anonymous22_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){ 584 575 ((void)((*___dst__P14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1)); 585 576 return ((struct __anonymous22 )___src__14s__anonymous22_1); 577 } 578 static inline void ___constructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1){ 579 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))) /* ?{} */); 580 } 581 static inline void ___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){ 582 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))=___src__14s__anonymous22_1.__i__i_1) /* ?{} */); 583 } 584 static inline void ___destructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1){ 585 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))) /* ^?{} */); 586 586 } 587 587 static inline void ___constructor__F_P14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, int __i__i_1){ … … 596 596 static inline void ___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1); 597 597 static inline void ___destructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1); 598 static inline void ___constructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1){599 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))) /* ?{} */);600 }601 static inline void ___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){602 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))=___src__14s__anonymous23_1.__i__i_1) /* ?{} */);603 }604 static inline void ___destructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1){605 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))) /* ^?{} */);606 }607 598 static inline struct __anonymous23 ___operator_assign__F14s__anonymous23_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){ 608 599 ((void)((*___dst__P14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1)); 609 600 return ((struct __anonymous23 )___src__14s__anonymous23_1); 601 } 602 static inline void ___constructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1){ 603 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))) /* ?{} */); 604 } 605 static inline void ___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){ 606 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))=___src__14s__anonymous23_1.__i__i_1) /* ?{} */); 607 } 608 static inline void ___destructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1){ 609 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))) /* ^?{} */); 610 610 } 611 611 static inline void ___constructor__F_P14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, int __i__i_1){ … … 622 622 static inline volatile const short __f48__FCVs___1(); 623 623 int main(int __argc__i_1, const char **__argv__PPCc_1){ 624 int _ __retval_main__i_1;625 ((void)(_ __retval_main__i_1=((int )0)) /* ?{} */);626 return ((int )_ __retval_main__i_1);627 } 624 int _retVal0 = { 0 }; 625 ((void)(_retVal0=((int )0)) /* ?{} */); 626 return ((int )_retVal0); 627 } -
src/tests/.expect/32/extension.txt
r66f8528 r596f987b 17 17 static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1); 18 18 static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1); 19 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 20 ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1)); 21 ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1)); 22 ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1)); 23 return ((struct S )___src__2sS_1); 24 } 19 25 static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){ 20 26 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))) /* ?{} */); … … 31 37 ((void)((*((int *)(&(*___dst__P2sS_1).__b__i_1)))) /* ^?{} */); 32 38 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))) /* ^?{} */); 33 }34 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){35 ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1));36 ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1));37 ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1));38 return ((struct S )___src__2sS_1);39 39 } 40 40 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__i_1){ … … 58 58 __extension__ int __c__i_1; 59 59 }; 60 static inline union U ___operator_assign__F2uU_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){ 61 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U ))); 62 return ((union U )___src__2uU_1); 63 } 60 64 static inline void ___constructor__F_P2uU_autogen___1(union U *___dst__P2uU_1){ 61 65 } 62 66 static inline void ___constructor__F_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){ 63 67 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U ))); 68 return ((void)___src__2uU_1); 64 69 } 65 70 static inline void ___destructor__F_P2uU_autogen___1(union U *___dst__P2uU_1){ 66 }67 static inline union U ___operator_assign__F2uU_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){68 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U )));69 return ((union U )___src__2uU_1);70 71 } 71 72 static inline void ___constructor__F_P2uUi_autogen___1(union U *___dst__P2uU_1, int __src__i_1){ … … 78 79 }; 79 80 __extension__ int __fred__Fi_i__1(int __p__i_1){ 80 int ___retval_fred__i_1;81 81 __extension__ struct S { 82 82 __extension__ int __a__i_2; -
src/tests/.expect/32/gccExtensions.txt
r66f8528 r596f987b 7 7 extern int __x__i_1 asm ( "xx" ); 8 8 int main(int __argc__i_1, const char **__argv__PPCc_1){ 9 int ___retval_main__i_1;10 9 asm ( "nop" : : : ); 11 10 asm ( "nop" : : : ); … … 26 25 const int __i3__Ci_2; 27 26 inline int __f1__Fi___2(){ 28 int ___retval_f1__i_2;29 27 } 30 28 inline int __f2__Fi___2(){ 31 int ___retval_f2__i_2;32 29 } 33 30 int __s1__i_2; … … 43 40 __extension__ int __c__i_2; 44 41 }; 42 inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___2(struct S *___dst__P2sS_2, struct S ___src__2sS_2){ 43 ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2)); 44 ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2)); 45 ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2)); 46 return ((struct S )___src__2sS_2); 47 } 45 48 inline void ___constructor__F_P2sS_autogen___2(struct S *___dst__P2sS_2){ 46 49 ((void)((*((int *)(&(*___dst__P2sS_2).__a__i_2)))) /* ?{} */); … … 57 60 ((void)((*((int *)(&(*___dst__P2sS_2).__b__i_2)))) /* ^?{} */); 58 61 ((void)((*((int *)(&(*___dst__P2sS_2).__a__i_2)))) /* ^?{} */); 59 }60 inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___2(struct S *___dst__P2sS_2, struct S ___src__2sS_2){61 ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2));62 ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2));63 ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2));64 return ((struct S )___src__2sS_2);65 62 } 66 63 inline void ___constructor__F_P2sSi_autogen___2(struct S *___dst__P2sS_2, int __a__i_2){ … … 99 96 int __i__i_2; 100 97 }; 98 inline struct s2 ___operator_assign__F3ss2_P3ss23ss2_autogen___2(struct s2 *___dst__P3ss2_2, struct s2 ___src__3ss2_2){ 99 ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2)); 100 return ((struct s2 )___src__3ss2_2); 101 } 101 102 inline void ___constructor__F_P3ss2_autogen___2(struct s2 *___dst__P3ss2_2){ 102 103 ((void)((*((int *)(&(*___dst__P3ss2_2).__i__i_2)))) /* ?{} */); … … 108 109 ((void)((*((int *)(&(*___dst__P3ss2_2).__i__i_2)))) /* ^?{} */); 109 110 } 110 inline struct s2 ___operator_assign__F3ss2_P3ss23ss2_autogen___2(struct s2 *___dst__P3ss2_2, struct s2 ___src__3ss2_2){111 ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2));112 return ((struct s2 )___src__3ss2_2);113 }114 111 inline void ___constructor__F_P3ss2i_autogen___2(struct s2 *___dst__P3ss2_2, int __i__i_2){ 115 112 ((void)((*((int *)(&(*___dst__P3ss2_2).__i__i_2)))=__i__i_2) /* ?{} */); … … 118 115 int __i__i_2; 119 116 }; 117 inline struct s3 ___operator_assign__F3ss3_P3ss33ss3_autogen___2(struct s3 *___dst__P3ss3_2, struct s3 ___src__3ss3_2){ 118 ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2)); 119 return ((struct s3 )___src__3ss3_2); 120 } 120 121 inline void ___constructor__F_P3ss3_autogen___2(struct s3 *___dst__P3ss3_2){ 121 122 ((void)((*((int *)(&(*___dst__P3ss3_2).__i__i_2)))) /* ?{} */); … … 127 128 ((void)((*((int *)(&(*___dst__P3ss3_2).__i__i_2)))) /* ^?{} */); 128 129 } 129 inline struct s3 ___operator_assign__F3ss3_P3ss33ss3_autogen___2(struct s3 *___dst__P3ss3_2, struct s3 ___src__3ss3_2){130 ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2));131 return ((struct s3 )___src__3ss3_2);132 }133 130 inline void ___constructor__F_P3ss3i_autogen___2(struct s3 *___dst__P3ss3_2, int __i__i_2){ 134 131 ((void)((*((int *)(&(*___dst__P3ss3_2).__i__i_2)))=__i__i_2) /* ?{} */); … … 139 136 int __i__i_2; 140 137 }; 138 inline struct s4 ___operator_assign__F3ss4_P3ss43ss4_autogen___2(struct s4 *___dst__P3ss4_2, struct s4 ___src__3ss4_2){ 139 ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2)); 140 return ((struct s4 )___src__3ss4_2); 141 } 141 142 inline void ___constructor__F_P3ss4_autogen___2(struct s4 *___dst__P3ss4_2){ 142 143 ((void)((*((int *)(&(*___dst__P3ss4_2).__i__i_2)))) /* ?{} */); … … 148 149 ((void)((*((int *)(&(*___dst__P3ss4_2).__i__i_2)))) /* ^?{} */); 149 150 } 150 inline struct s4 ___operator_assign__F3ss4_P3ss43ss4_autogen___2(struct s4 *___dst__P3ss4_2, struct s4 ___src__3ss4_2){151 ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2));152 return ((struct s4 )___src__3ss4_2);153 }154 151 inline void ___constructor__F_P3ss4i_autogen___2(struct s4 *___dst__P3ss4_2, int __i__i_2){ 155 152 ((void)((*((int *)(&(*___dst__P3ss4_2).__i__i_2)))=__i__i_2) /* ?{} */); … … 160 157 int __m2__A0A0i_2[((unsigned int )10)][((unsigned int )10)]; 161 158 int __m3__A0A0i_2[((unsigned int )10)][((unsigned int )10)]; 162 ((void)(___retval_main__i_1=((int )0)) /* ?{} */); 163 return ((int )___retval_main__i_1); 159 int _retVal0 = { 0 }; 160 ((void)(_retVal0=((int )0)) /* ?{} */); 161 return ((int )_retVal0); 164 162 } -
src/tests/.expect/64/declarationSpecifier.txt
r66f8528 r596f987b 20 20 static inline void ___constructor__F_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1); 21 21 static inline void ___destructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1); 22 static inline void ___constructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1){23 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))) /* ?{} */);24 }25 static inline void ___constructor__F_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){26 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))=___src__13s__anonymous0_1.__i__i_1) /* ?{} */);27 }28 static inline void ___destructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1){29 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))) /* ^?{} */);30 }31 22 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 32 23 ((void)((*___dst__P13s__anonymous0_1).__i__i_1=___src__13s__anonymous0_1.__i__i_1)); 33 24 return ((struct __anonymous0 )___src__13s__anonymous0_1); 25 } 26 static inline void ___constructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1){ 27 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))) /* ?{} */); 28 } 29 static inline void ___constructor__F_P13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 30 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))=___src__13s__anonymous0_1.__i__i_1) /* ?{} */); 31 } 32 static inline void ___destructor__F_P13s__anonymous0_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1){ 33 ((void)((*((int *)(&(*___dst__P13s__anonymous0_1).__i__i_1)))) /* ^?{} */); 34 34 } 35 35 static inline void ___constructor__F_P13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__P13s__anonymous0_1, int __i__i_1){ … … 44 44 static inline void ___constructor__F_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1); 45 45 static inline void ___destructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1); 46 static inline void ___constructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1){47 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))) /* ?{} */);48 }49 static inline void ___constructor__F_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){50 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))=___src__13s__anonymous1_1.__i__i_1) /* ?{} */);51 }52 static inline void ___destructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1){53 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))) /* ^?{} */);54 }55 46 static inline struct __anonymous1 ___operator_assign__F13s__anonymous1_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){ 56 47 ((void)((*___dst__P13s__anonymous1_1).__i__i_1=___src__13s__anonymous1_1.__i__i_1)); 57 48 return ((struct __anonymous1 )___src__13s__anonymous1_1); 49 } 50 static inline void ___constructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1){ 51 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))) /* ?{} */); 52 } 53 static inline void ___constructor__F_P13s__anonymous113s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, struct __anonymous1 ___src__13s__anonymous1_1){ 54 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))=___src__13s__anonymous1_1.__i__i_1) /* ?{} */); 55 } 56 static inline void ___destructor__F_P13s__anonymous1_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1){ 57 ((void)((*((int *)(&(*___dst__P13s__anonymous1_1).__i__i_1)))) /* ^?{} */); 58 58 } 59 59 static inline void ___constructor__F_P13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__P13s__anonymous1_1, int __i__i_1){ … … 68 68 static inline void ___constructor__F_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1); 69 69 static inline void ___destructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1); 70 static inline void ___constructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1){71 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))) /* ?{} */);72 }73 static inline void ___constructor__F_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){74 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))=___src__13s__anonymous2_1.__i__i_1) /* ?{} */);75 }76 static inline void ___destructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1){77 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))) /* ^?{} */);78 }79 70 static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 80 71 ((void)((*___dst__P13s__anonymous2_1).__i__i_1=___src__13s__anonymous2_1.__i__i_1)); 81 72 return ((struct __anonymous2 )___src__13s__anonymous2_1); 73 } 74 static inline void ___constructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1){ 75 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))) /* ?{} */); 76 } 77 static inline void ___constructor__F_P13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 78 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))=___src__13s__anonymous2_1.__i__i_1) /* ?{} */); 79 } 80 static inline void ___destructor__F_P13s__anonymous2_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1){ 81 ((void)((*((int *)(&(*___dst__P13s__anonymous2_1).__i__i_1)))) /* ^?{} */); 82 82 } 83 83 static inline void ___constructor__F_P13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__P13s__anonymous2_1, int __i__i_1){ … … 92 92 static inline void ___constructor__F_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1); 93 93 static inline void ___destructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1); 94 static inline void ___constructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1){95 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))) /* ?{} */);96 }97 static inline void ___constructor__F_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){98 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))=___src__13s__anonymous3_1.__i__i_1) /* ?{} */);99 }100 static inline void ___destructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1){101 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))) /* ^?{} */);102 }103 94 static inline struct __anonymous3 ___operator_assign__F13s__anonymous3_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){ 104 95 ((void)((*___dst__P13s__anonymous3_1).__i__i_1=___src__13s__anonymous3_1.__i__i_1)); 105 96 return ((struct __anonymous3 )___src__13s__anonymous3_1); 97 } 98 static inline void ___constructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1){ 99 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))) /* ?{} */); 100 } 101 static inline void ___constructor__F_P13s__anonymous313s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, struct __anonymous3 ___src__13s__anonymous3_1){ 102 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))=___src__13s__anonymous3_1.__i__i_1) /* ?{} */); 103 } 104 static inline void ___destructor__F_P13s__anonymous3_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1){ 105 ((void)((*((int *)(&(*___dst__P13s__anonymous3_1).__i__i_1)))) /* ^?{} */); 106 106 } 107 107 static inline void ___constructor__F_P13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__P13s__anonymous3_1, int __i__i_1){ … … 116 116 static inline void ___constructor__F_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1); 117 117 static inline void ___destructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1); 118 static inline void ___constructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1){119 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))) /* ?{} */);120 }121 static inline void ___constructor__F_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){122 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))=___src__13s__anonymous4_1.__i__i_1) /* ?{} */);123 }124 static inline void ___destructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1){125 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))) /* ^?{} */);126 }127 118 static inline struct __anonymous4 ___operator_assign__F13s__anonymous4_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){ 128 119 ((void)((*___dst__P13s__anonymous4_1).__i__i_1=___src__13s__anonymous4_1.__i__i_1)); 129 120 return ((struct __anonymous4 )___src__13s__anonymous4_1); 121 } 122 static inline void ___constructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1){ 123 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))) /* ?{} */); 124 } 125 static inline void ___constructor__F_P13s__anonymous413s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, struct __anonymous4 ___src__13s__anonymous4_1){ 126 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))=___src__13s__anonymous4_1.__i__i_1) /* ?{} */); 127 } 128 static inline void ___destructor__F_P13s__anonymous4_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1){ 129 ((void)((*((int *)(&(*___dst__P13s__anonymous4_1).__i__i_1)))) /* ^?{} */); 130 130 } 131 131 static inline void ___constructor__F_P13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__P13s__anonymous4_1, int __i__i_1){ … … 140 140 static inline void ___constructor__F_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1); 141 141 static inline void ___destructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1); 142 static inline void ___constructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1){143 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))) /* ?{} */);144 }145 static inline void ___constructor__F_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){146 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))=___src__13s__anonymous5_1.__i__i_1) /* ?{} */);147 }148 static inline void ___destructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1){149 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))) /* ^?{} */);150 }151 142 static inline struct __anonymous5 ___operator_assign__F13s__anonymous5_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){ 152 143 ((void)((*___dst__P13s__anonymous5_1).__i__i_1=___src__13s__anonymous5_1.__i__i_1)); 153 144 return ((struct __anonymous5 )___src__13s__anonymous5_1); 145 } 146 static inline void ___constructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1){ 147 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))) /* ?{} */); 148 } 149 static inline void ___constructor__F_P13s__anonymous513s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, struct __anonymous5 ___src__13s__anonymous5_1){ 150 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))=___src__13s__anonymous5_1.__i__i_1) /* ?{} */); 151 } 152 static inline void ___destructor__F_P13s__anonymous5_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1){ 153 ((void)((*((int *)(&(*___dst__P13s__anonymous5_1).__i__i_1)))) /* ^?{} */); 154 154 } 155 155 static inline void ___constructor__F_P13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__P13s__anonymous5_1, int __i__i_1){ … … 164 164 static inline void ___constructor__F_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1); 165 165 static inline void ___destructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1); 166 static inline void ___constructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1){167 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))) /* ?{} */);168 }169 static inline void ___constructor__F_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){170 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))=___src__13s__anonymous6_1.__i__i_1) /* ?{} */);171 }172 static inline void ___destructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1){173 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))) /* ^?{} */);174 }175 166 static inline struct __anonymous6 ___operator_assign__F13s__anonymous6_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){ 176 167 ((void)((*___dst__P13s__anonymous6_1).__i__i_1=___src__13s__anonymous6_1.__i__i_1)); 177 168 return ((struct __anonymous6 )___src__13s__anonymous6_1); 169 } 170 static inline void ___constructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1){ 171 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))) /* ?{} */); 172 } 173 static inline void ___constructor__F_P13s__anonymous613s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, struct __anonymous6 ___src__13s__anonymous6_1){ 174 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))=___src__13s__anonymous6_1.__i__i_1) /* ?{} */); 175 } 176 static inline void ___destructor__F_P13s__anonymous6_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1){ 177 ((void)((*((int *)(&(*___dst__P13s__anonymous6_1).__i__i_1)))) /* ^?{} */); 178 178 } 179 179 static inline void ___constructor__F_P13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__P13s__anonymous6_1, int __i__i_1){ … … 188 188 static inline void ___constructor__F_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1); 189 189 static inline void ___destructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1); 190 static inline void ___constructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1){191 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))) /* ?{} */);192 }193 static inline void ___constructor__F_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){194 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))=___src__13s__anonymous7_1.__i__i_1) /* ?{} */);195 }196 static inline void ___destructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1){197 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))) /* ^?{} */);198 }199 190 static inline struct __anonymous7 ___operator_assign__F13s__anonymous7_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){ 200 191 ((void)((*___dst__P13s__anonymous7_1).__i__i_1=___src__13s__anonymous7_1.__i__i_1)); 201 192 return ((struct __anonymous7 )___src__13s__anonymous7_1); 193 } 194 static inline void ___constructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1){ 195 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))) /* ?{} */); 196 } 197 static inline void ___constructor__F_P13s__anonymous713s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, struct __anonymous7 ___src__13s__anonymous7_1){ 198 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))=___src__13s__anonymous7_1.__i__i_1) /* ?{} */); 199 } 200 static inline void ___destructor__F_P13s__anonymous7_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1){ 201 ((void)((*((int *)(&(*___dst__P13s__anonymous7_1).__i__i_1)))) /* ^?{} */); 202 202 } 203 203 static inline void ___constructor__F_P13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__P13s__anonymous7_1, int __i__i_1){ … … 220 220 static inline void ___constructor__F_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1); 221 221 static inline void ___destructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1); 222 static inline void ___constructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1){223 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))) /* ?{} */);224 }225 static inline void ___constructor__F_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){226 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))=___src__13s__anonymous8_1.__i__s_1) /* ?{} */);227 }228 static inline void ___destructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1){229 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))) /* ^?{} */);230 }231 222 static inline struct __anonymous8 ___operator_assign__F13s__anonymous8_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){ 232 223 ((void)((*___dst__P13s__anonymous8_1).__i__s_1=___src__13s__anonymous8_1.__i__s_1)); 233 224 return ((struct __anonymous8 )___src__13s__anonymous8_1); 225 } 226 static inline void ___constructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1){ 227 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))) /* ?{} */); 228 } 229 static inline void ___constructor__F_P13s__anonymous813s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, struct __anonymous8 ___src__13s__anonymous8_1){ 230 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))=___src__13s__anonymous8_1.__i__s_1) /* ?{} */); 231 } 232 static inline void ___destructor__F_P13s__anonymous8_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1){ 233 ((void)((*((short *)(&(*___dst__P13s__anonymous8_1).__i__s_1)))) /* ^?{} */); 234 234 } 235 235 static inline void ___constructor__F_P13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__P13s__anonymous8_1, short __i__s_1){ … … 244 244 static inline void ___constructor__F_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1); 245 245 static inline void ___destructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1); 246 static inline void ___constructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1){247 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))) /* ?{} */);248 }249 static inline void ___constructor__F_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){250 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))=___src__13s__anonymous9_1.__i__s_1) /* ?{} */);251 }252 static inline void ___destructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1){253 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))) /* ^?{} */);254 }255 246 static inline struct __anonymous9 ___operator_assign__F13s__anonymous9_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){ 256 247 ((void)((*___dst__P13s__anonymous9_1).__i__s_1=___src__13s__anonymous9_1.__i__s_1)); 257 248 return ((struct __anonymous9 )___src__13s__anonymous9_1); 249 } 250 static inline void ___constructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1){ 251 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))) /* ?{} */); 252 } 253 static inline void ___constructor__F_P13s__anonymous913s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, struct __anonymous9 ___src__13s__anonymous9_1){ 254 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))=___src__13s__anonymous9_1.__i__s_1) /* ?{} */); 255 } 256 static inline void ___destructor__F_P13s__anonymous9_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1){ 257 ((void)((*((short *)(&(*___dst__P13s__anonymous9_1).__i__s_1)))) /* ^?{} */); 258 258 } 259 259 static inline void ___constructor__F_P13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__P13s__anonymous9_1, short __i__s_1){ … … 268 268 static inline void ___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1); 269 269 static inline void ___destructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1); 270 static inline void ___constructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1){271 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))) /* ?{} */);272 }273 static inline void ___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){274 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))=___src__14s__anonymous10_1.__i__s_1) /* ?{} */);275 }276 static inline void ___destructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1){277 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))) /* ^?{} */);278 }279 270 static inline struct __anonymous10 ___operator_assign__F14s__anonymous10_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){ 280 271 ((void)((*___dst__P14s__anonymous10_1).__i__s_1=___src__14s__anonymous10_1.__i__s_1)); 281 272 return ((struct __anonymous10 )___src__14s__anonymous10_1); 273 } 274 static inline void ___constructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1){ 275 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))) /* ?{} */); 276 } 277 static inline void ___constructor__F_P14s__anonymous1014s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, struct __anonymous10 ___src__14s__anonymous10_1){ 278 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))=___src__14s__anonymous10_1.__i__s_1) /* ?{} */); 279 } 280 static inline void ___destructor__F_P14s__anonymous10_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1){ 281 ((void)((*((short *)(&(*___dst__P14s__anonymous10_1).__i__s_1)))) /* ^?{} */); 282 282 } 283 283 static inline void ___constructor__F_P14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__P14s__anonymous10_1, short __i__s_1){ … … 292 292 static inline void ___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1); 293 293 static inline void ___destructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1); 294 static inline void ___constructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1){295 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))) /* ?{} */);296 }297 static inline void ___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){298 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))=___src__14s__anonymous11_1.__i__s_1) /* ?{} */);299 }300 static inline void ___destructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1){301 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))) /* ^?{} */);302 }303 294 static inline struct __anonymous11 ___operator_assign__F14s__anonymous11_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){ 304 295 ((void)((*___dst__P14s__anonymous11_1).__i__s_1=___src__14s__anonymous11_1.__i__s_1)); 305 296 return ((struct __anonymous11 )___src__14s__anonymous11_1); 297 } 298 static inline void ___constructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1){ 299 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))) /* ?{} */); 300 } 301 static inline void ___constructor__F_P14s__anonymous1114s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, struct __anonymous11 ___src__14s__anonymous11_1){ 302 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))=___src__14s__anonymous11_1.__i__s_1) /* ?{} */); 303 } 304 static inline void ___destructor__F_P14s__anonymous11_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1){ 305 ((void)((*((short *)(&(*___dst__P14s__anonymous11_1).__i__s_1)))) /* ^?{} */); 306 306 } 307 307 static inline void ___constructor__F_P14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__P14s__anonymous11_1, short __i__s_1){ … … 316 316 static inline void ___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1); 317 317 static inline void ___destructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1); 318 static inline void ___constructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1){319 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))) /* ?{} */);320 }321 static inline void ___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){322 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))=___src__14s__anonymous12_1.__i__s_1) /* ?{} */);323 }324 static inline void ___destructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1){325 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))) /* ^?{} */);326 }327 318 static inline struct __anonymous12 ___operator_assign__F14s__anonymous12_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){ 328 319 ((void)((*___dst__P14s__anonymous12_1).__i__s_1=___src__14s__anonymous12_1.__i__s_1)); 329 320 return ((struct __anonymous12 )___src__14s__anonymous12_1); 321 } 322 static inline void ___constructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1){ 323 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))) /* ?{} */); 324 } 325 static inline void ___constructor__F_P14s__anonymous1214s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, struct __anonymous12 ___src__14s__anonymous12_1){ 326 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))=___src__14s__anonymous12_1.__i__s_1) /* ?{} */); 327 } 328 static inline void ___destructor__F_P14s__anonymous12_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1){ 329 ((void)((*((short *)(&(*___dst__P14s__anonymous12_1).__i__s_1)))) /* ^?{} */); 330 330 } 331 331 static inline void ___constructor__F_P14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__P14s__anonymous12_1, short __i__s_1){ … … 340 340 static inline void ___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1); 341 341 static inline void ___destructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1); 342 static inline void ___constructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1){343 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))) /* ?{} */);344 }345 static inline void ___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){346 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))=___src__14s__anonymous13_1.__i__s_1) /* ?{} */);347 }348 static inline void ___destructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1){349 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))) /* ^?{} */);350 }351 342 static inline struct __anonymous13 ___operator_assign__F14s__anonymous13_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){ 352 343 ((void)((*___dst__P14s__anonymous13_1).__i__s_1=___src__14s__anonymous13_1.__i__s_1)); 353 344 return ((struct __anonymous13 )___src__14s__anonymous13_1); 345 } 346 static inline void ___constructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1){ 347 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))) /* ?{} */); 348 } 349 static inline void ___constructor__F_P14s__anonymous1314s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, struct __anonymous13 ___src__14s__anonymous13_1){ 350 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))=___src__14s__anonymous13_1.__i__s_1) /* ?{} */); 351 } 352 static inline void ___destructor__F_P14s__anonymous13_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1){ 353 ((void)((*((short *)(&(*___dst__P14s__anonymous13_1).__i__s_1)))) /* ^?{} */); 354 354 } 355 355 static inline void ___constructor__F_P14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__P14s__anonymous13_1, short __i__s_1){ … … 364 364 static inline void ___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1); 365 365 static inline void ___destructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1); 366 static inline void ___constructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1){367 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))) /* ?{} */);368 }369 static inline void ___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){370 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))=___src__14s__anonymous14_1.__i__s_1) /* ?{} */);371 }372 static inline void ___destructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1){373 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))) /* ^?{} */);374 }375 366 static inline struct __anonymous14 ___operator_assign__F14s__anonymous14_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){ 376 367 ((void)((*___dst__P14s__anonymous14_1).__i__s_1=___src__14s__anonymous14_1.__i__s_1)); 377 368 return ((struct __anonymous14 )___src__14s__anonymous14_1); 369 } 370 static inline void ___constructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1){ 371 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))) /* ?{} */); 372 } 373 static inline void ___constructor__F_P14s__anonymous1414s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, struct __anonymous14 ___src__14s__anonymous14_1){ 374 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))=___src__14s__anonymous14_1.__i__s_1) /* ?{} */); 375 } 376 static inline void ___destructor__F_P14s__anonymous14_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1){ 377 ((void)((*((short *)(&(*___dst__P14s__anonymous14_1).__i__s_1)))) /* ^?{} */); 378 378 } 379 379 static inline void ___constructor__F_P14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__P14s__anonymous14_1, short __i__s_1){ … … 388 388 static inline void ___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1); 389 389 static inline void ___destructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1); 390 static inline void ___constructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1){391 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))) /* ?{} */);392 }393 static inline void ___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){394 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))=___src__14s__anonymous15_1.__i__s_1) /* ?{} */);395 }396 static inline void ___destructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1){397 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))) /* ^?{} */);398 }399 390 static inline struct __anonymous15 ___operator_assign__F14s__anonymous15_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){ 400 391 ((void)((*___dst__P14s__anonymous15_1).__i__s_1=___src__14s__anonymous15_1.__i__s_1)); 401 392 return ((struct __anonymous15 )___src__14s__anonymous15_1); 393 } 394 static inline void ___constructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1){ 395 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))) /* ?{} */); 396 } 397 static inline void ___constructor__F_P14s__anonymous1514s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, struct __anonymous15 ___src__14s__anonymous15_1){ 398 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))=___src__14s__anonymous15_1.__i__s_1) /* ?{} */); 399 } 400 static inline void ___destructor__F_P14s__anonymous15_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1){ 401 ((void)((*((short *)(&(*___dst__P14s__anonymous15_1).__i__s_1)))) /* ^?{} */); 402 402 } 403 403 static inline void ___constructor__F_P14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__P14s__anonymous15_1, short __i__s_1){ … … 428 428 static inline void ___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1); 429 429 static inline void ___destructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1); 430 static inline void ___constructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1){431 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))) /* ?{} */);432 }433 static inline void ___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){434 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))=___src__14s__anonymous16_1.__i__i_1) /* ?{} */);435 }436 static inline void ___destructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1){437 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))) /* ^?{} */);438 }439 430 static inline struct __anonymous16 ___operator_assign__F14s__anonymous16_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){ 440 431 ((void)((*___dst__P14s__anonymous16_1).__i__i_1=___src__14s__anonymous16_1.__i__i_1)); 441 432 return ((struct __anonymous16 )___src__14s__anonymous16_1); 433 } 434 static inline void ___constructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1){ 435 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))) /* ?{} */); 436 } 437 static inline void ___constructor__F_P14s__anonymous1614s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, struct __anonymous16 ___src__14s__anonymous16_1){ 438 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))=___src__14s__anonymous16_1.__i__i_1) /* ?{} */); 439 } 440 static inline void ___destructor__F_P14s__anonymous16_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1){ 441 ((void)((*((int *)(&(*___dst__P14s__anonymous16_1).__i__i_1)))) /* ^?{} */); 442 442 } 443 443 static inline void ___constructor__F_P14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__P14s__anonymous16_1, int __i__i_1){ … … 452 452 static inline void ___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1); 453 453 static inline void ___destructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1); 454 static inline void ___constructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1){455 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))) /* ?{} */);456 }457 static inline void ___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){458 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))=___src__14s__anonymous17_1.__i__i_1) /* ?{} */);459 }460 static inline void ___destructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1){461 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))) /* ^?{} */);462 }463 454 static inline struct __anonymous17 ___operator_assign__F14s__anonymous17_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){ 464 455 ((void)((*___dst__P14s__anonymous17_1).__i__i_1=___src__14s__anonymous17_1.__i__i_1)); 465 456 return ((struct __anonymous17 )___src__14s__anonymous17_1); 457 } 458 static inline void ___constructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1){ 459 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))) /* ?{} */); 460 } 461 static inline void ___constructor__F_P14s__anonymous1714s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, struct __anonymous17 ___src__14s__anonymous17_1){ 462 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))=___src__14s__anonymous17_1.__i__i_1) /* ?{} */); 463 } 464 static inline void ___destructor__F_P14s__anonymous17_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1){ 465 ((void)((*((int *)(&(*___dst__P14s__anonymous17_1).__i__i_1)))) /* ^?{} */); 466 466 } 467 467 static inline void ___constructor__F_P14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__P14s__anonymous17_1, int __i__i_1){ … … 476 476 static inline void ___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1); 477 477 static inline void ___destructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1); 478 static inline void ___constructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1){479 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))) /* ?{} */);480 }481 static inline void ___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){482 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))=___src__14s__anonymous18_1.__i__i_1) /* ?{} */);483 }484 static inline void ___destructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1){485 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))) /* ^?{} */);486 }487 478 static inline struct __anonymous18 ___operator_assign__F14s__anonymous18_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){ 488 479 ((void)((*___dst__P14s__anonymous18_1).__i__i_1=___src__14s__anonymous18_1.__i__i_1)); 489 480 return ((struct __anonymous18 )___src__14s__anonymous18_1); 481 } 482 static inline void ___constructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1){ 483 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))) /* ?{} */); 484 } 485 static inline void ___constructor__F_P14s__anonymous1814s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, struct __anonymous18 ___src__14s__anonymous18_1){ 486 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))=___src__14s__anonymous18_1.__i__i_1) /* ?{} */); 487 } 488 static inline void ___destructor__F_P14s__anonymous18_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1){ 489 ((void)((*((int *)(&(*___dst__P14s__anonymous18_1).__i__i_1)))) /* ^?{} */); 490 490 } 491 491 static inline void ___constructor__F_P14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__P14s__anonymous18_1, int __i__i_1){ … … 500 500 static inline void ___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1); 501 501 static inline void ___destructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1); 502 static inline void ___constructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1){503 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))) /* ?{} */);504 }505 static inline void ___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){506 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))=___src__14s__anonymous19_1.__i__i_1) /* ?{} */);507 }508 static inline void ___destructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1){509 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))) /* ^?{} */);510 }511 502 static inline struct __anonymous19 ___operator_assign__F14s__anonymous19_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){ 512 503 ((void)((*___dst__P14s__anonymous19_1).__i__i_1=___src__14s__anonymous19_1.__i__i_1)); 513 504 return ((struct __anonymous19 )___src__14s__anonymous19_1); 505 } 506 static inline void ___constructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1){ 507 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))) /* ?{} */); 508 } 509 static inline void ___constructor__F_P14s__anonymous1914s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, struct __anonymous19 ___src__14s__anonymous19_1){ 510 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))=___src__14s__anonymous19_1.__i__i_1) /* ?{} */); 511 } 512 static inline void ___destructor__F_P14s__anonymous19_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1){ 513 ((void)((*((int *)(&(*___dst__P14s__anonymous19_1).__i__i_1)))) /* ^?{} */); 514 514 } 515 515 static inline void ___constructor__F_P14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__P14s__anonymous19_1, int __i__i_1){ … … 524 524 static inline void ___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1); 525 525 static inline void ___destructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1); 526 static inline void ___constructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1){527 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))) /* ?{} */);528 }529 static inline void ___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){530 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))=___src__14s__anonymous20_1.__i__i_1) /* ?{} */);531 }532 static inline void ___destructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1){533 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))) /* ^?{} */);534 }535 526 static inline struct __anonymous20 ___operator_assign__F14s__anonymous20_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){ 536 527 ((void)((*___dst__P14s__anonymous20_1).__i__i_1=___src__14s__anonymous20_1.__i__i_1)); 537 528 return ((struct __anonymous20 )___src__14s__anonymous20_1); 529 } 530 static inline void ___constructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1){ 531 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))) /* ?{} */); 532 } 533 static inline void ___constructor__F_P14s__anonymous2014s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, struct __anonymous20 ___src__14s__anonymous20_1){ 534 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))=___src__14s__anonymous20_1.__i__i_1) /* ?{} */); 535 } 536 static inline void ___destructor__F_P14s__anonymous20_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1){ 537 ((void)((*((int *)(&(*___dst__P14s__anonymous20_1).__i__i_1)))) /* ^?{} */); 538 538 } 539 539 static inline void ___constructor__F_P14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__P14s__anonymous20_1, int __i__i_1){ … … 548 548 static inline void ___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1); 549 549 static inline void ___destructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1); 550 static inline void ___constructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1){551 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))) /* ?{} */);552 }553 static inline void ___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){554 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))=___src__14s__anonymous21_1.__i__i_1) /* ?{} */);555 }556 static inline void ___destructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1){557 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))) /* ^?{} */);558 }559 550 static inline struct __anonymous21 ___operator_assign__F14s__anonymous21_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){ 560 551 ((void)((*___dst__P14s__anonymous21_1).__i__i_1=___src__14s__anonymous21_1.__i__i_1)); 561 552 return ((struct __anonymous21 )___src__14s__anonymous21_1); 553 } 554 static inline void ___constructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1){ 555 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))) /* ?{} */); 556 } 557 static inline void ___constructor__F_P14s__anonymous2114s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, struct __anonymous21 ___src__14s__anonymous21_1){ 558 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))=___src__14s__anonymous21_1.__i__i_1) /* ?{} */); 559 } 560 static inline void ___destructor__F_P14s__anonymous21_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1){ 561 ((void)((*((int *)(&(*___dst__P14s__anonymous21_1).__i__i_1)))) /* ^?{} */); 562 562 } 563 563 static inline void ___constructor__F_P14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__P14s__anonymous21_1, int __i__i_1){ … … 572 572 static inline void ___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1); 573 573 static inline void ___destructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1); 574 static inline void ___constructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1){575 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))) /* ?{} */);576 }577 static inline void ___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){578 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))=___src__14s__anonymous22_1.__i__i_1) /* ?{} */);579 }580 static inline void ___destructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1){581 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))) /* ^?{} */);582 }583 574 static inline struct __anonymous22 ___operator_assign__F14s__anonymous22_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){ 584 575 ((void)((*___dst__P14s__anonymous22_1).__i__i_1=___src__14s__anonymous22_1.__i__i_1)); 585 576 return ((struct __anonymous22 )___src__14s__anonymous22_1); 577 } 578 static inline void ___constructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1){ 579 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))) /* ?{} */); 580 } 581 static inline void ___constructor__F_P14s__anonymous2214s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, struct __anonymous22 ___src__14s__anonymous22_1){ 582 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))=___src__14s__anonymous22_1.__i__i_1) /* ?{} */); 583 } 584 static inline void ___destructor__F_P14s__anonymous22_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1){ 585 ((void)((*((int *)(&(*___dst__P14s__anonymous22_1).__i__i_1)))) /* ^?{} */); 586 586 } 587 587 static inline void ___constructor__F_P14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__P14s__anonymous22_1, int __i__i_1){ … … 596 596 static inline void ___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1); 597 597 static inline void ___destructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1); 598 static inline void ___constructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1){599 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))) /* ?{} */);600 }601 static inline void ___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){602 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))=___src__14s__anonymous23_1.__i__i_1) /* ?{} */);603 }604 static inline void ___destructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1){605 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))) /* ^?{} */);606 }607 598 static inline struct __anonymous23 ___operator_assign__F14s__anonymous23_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){ 608 599 ((void)((*___dst__P14s__anonymous23_1).__i__i_1=___src__14s__anonymous23_1.__i__i_1)); 609 600 return ((struct __anonymous23 )___src__14s__anonymous23_1); 601 } 602 static inline void ___constructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1){ 603 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))) /* ?{} */); 604 } 605 static inline void ___constructor__F_P14s__anonymous2314s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, struct __anonymous23 ___src__14s__anonymous23_1){ 606 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))=___src__14s__anonymous23_1.__i__i_1) /* ?{} */); 607 } 608 static inline void ___destructor__F_P14s__anonymous23_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1){ 609 ((void)((*((int *)(&(*___dst__P14s__anonymous23_1).__i__i_1)))) /* ^?{} */); 610 610 } 611 611 static inline void ___constructor__F_P14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__P14s__anonymous23_1, int __i__i_1){ … … 622 622 static inline volatile const short __f48__FCVs___1(); 623 623 int main(int __argc__i_1, const char **__argv__PPCc_1){ 624 int _ __retval_main__i_1;625 ((void)(_ __retval_main__i_1=((int )0)) /* ?{} */);626 return ((int )_ __retval_main__i_1);627 } 624 int _retVal0 = { 0 }; 625 ((void)(_retVal0=((int )0)) /* ?{} */); 626 return ((int )_retVal0); 627 } -
src/tests/.expect/64/extension.txt
r66f8528 r596f987b 17 17 static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1); 18 18 static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1); 19 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 20 ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1)); 21 ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1)); 22 ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1)); 23 return ((struct S )___src__2sS_1); 24 } 19 25 static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){ 20 26 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))) /* ?{} */); … … 31 37 ((void)((*((int *)(&(*___dst__P2sS_1).__b__i_1)))) /* ^?{} */); 32 38 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))) /* ^?{} */); 33 }34 static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){35 ((void)((*___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1));36 ((void)((*___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1));37 ((void)((*___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1));38 return ((struct S )___src__2sS_1);39 39 } 40 40 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__i_1){ … … 58 58 __extension__ int __c__i_1; 59 59 }; 60 static inline union U ___operator_assign__F2uU_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){ 61 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U ))); 62 return ((union U )___src__2uU_1); 63 } 60 64 static inline void ___constructor__F_P2uU_autogen___1(union U *___dst__P2uU_1){ 61 65 } 62 66 static inline void ___constructor__F_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){ 63 67 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U ))); 68 return ((void)___src__2uU_1); 64 69 } 65 70 static inline void ___destructor__F_P2uU_autogen___1(union U *___dst__P2uU_1){ 66 }67 static inline union U ___operator_assign__F2uU_P2uU2uU_autogen___1(union U *___dst__P2uU_1, union U ___src__2uU_1){68 ((void)__builtin_memcpy(((void *)___dst__P2uU_1), ((const void *)(&___src__2uU_1)), sizeof(union U )));69 return ((union U )___src__2uU_1);70 71 } 71 72 static inline void ___constructor__F_P2uUi_autogen___1(union U *___dst__P2uU_1, int __src__i_1){ … … 78 79 }; 79 80 __extension__ int __fred__Fi_i__1(int __p__i_1){ 80 int ___retval_fred__i_1;81 81 __extension__ struct S { 82 82 __extension__ int __a__i_2; -
src/tests/.expect/64/gccExtensions.txt
r66f8528 r596f987b 7 7 extern int __x__i_1 asm ( "xx" ); 8 8 int main(int __argc__i_1, const char **__argv__PPCc_1){ 9 int ___retval_main__i_1;10 9 asm ( "nop" : : : ); 11 10 asm ( "nop" : : : ); … … 26 25 const int __i3__Ci_2; 27 26 inline int __f1__Fi___2(){ 28 int ___retval_f1__i_2;29 27 } 30 28 inline int __f2__Fi___2(){ 31 int ___retval_f2__i_2;32 29 } 33 30 int __s1__i_2; … … 43 40 __extension__ int __c__i_2; 44 41 }; 42 inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___2(struct S *___dst__P2sS_2, struct S ___src__2sS_2){ 43 ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2)); 44 ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2)); 45 ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2)); 46 return ((struct S )___src__2sS_2); 47 } 45 48 inline void ___constructor__F_P2sS_autogen___2(struct S *___dst__P2sS_2){ 46 49 ((void)((*((int *)(&(*___dst__P2sS_2).__a__i_2)))) /* ?{} */); … … 57 60 ((void)((*((int *)(&(*___dst__P2sS_2).__b__i_2)))) /* ^?{} */); 58 61 ((void)((*((int *)(&(*___dst__P2sS_2).__a__i_2)))) /* ^?{} */); 59 }60 inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___2(struct S *___dst__P2sS_2, struct S ___src__2sS_2){61 ((void)((*___dst__P2sS_2).__a__i_2=___src__2sS_2.__a__i_2));62 ((void)((*___dst__P2sS_2).__b__i_2=___src__2sS_2.__b__i_2));63 ((void)((*___dst__P2sS_2).__c__i_2=___src__2sS_2.__c__i_2));64 return ((struct S )___src__2sS_2);65 62 } 66 63 inline void ___constructor__F_P2sSi_autogen___2(struct S *___dst__P2sS_2, int __a__i_2){ … … 99 96 int __i__i_2; 100 97 }; 98 inline struct s2 ___operator_assign__F3ss2_P3ss23ss2_autogen___2(struct s2 *___dst__P3ss2_2, struct s2 ___src__3ss2_2){ 99 ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2)); 100 return ((struct s2 )___src__3ss2_2); 101 } 101 102 inline void ___constructor__F_P3ss2_autogen___2(struct s2 *___dst__P3ss2_2){ 102 103 ((void)((*((int *)(&(*___dst__P3ss2_2).__i__i_2)))) /* ?{} */); … … 108 109 ((void)((*((int *)(&(*___dst__P3ss2_2).__i__i_2)))) /* ^?{} */); 109 110 } 110 inline struct s2 ___operator_assign__F3ss2_P3ss23ss2_autogen___2(struct s2 *___dst__P3ss2_2, struct s2 ___src__3ss2_2){111 ((void)((*___dst__P3ss2_2).__i__i_2=___src__3ss2_2.__i__i_2));112 return ((struct s2 )___src__3ss2_2);113 }114 111 inline void ___constructor__F_P3ss2i_autogen___2(struct s2 *___dst__P3ss2_2, int __i__i_2){ 115 112 ((void)((*((int *)(&(*___dst__P3ss2_2).__i__i_2)))=__i__i_2) /* ?{} */); … … 118 115 int __i__i_2; 119 116 }; 117 inline struct s3 ___operator_assign__F3ss3_P3ss33ss3_autogen___2(struct s3 *___dst__P3ss3_2, struct s3 ___src__3ss3_2){ 118 ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2)); 119 return ((struct s3 )___src__3ss3_2); 120 } 120 121 inline void ___constructor__F_P3ss3_autogen___2(struct s3 *___dst__P3ss3_2){ 121 122 ((void)((*((int *)(&(*___dst__P3ss3_2).__i__i_2)))) /* ?{} */); … … 127 128 ((void)((*((int *)(&(*___dst__P3ss3_2).__i__i_2)))) /* ^?{} */); 128 129 } 129 inline struct s3 ___operator_assign__F3ss3_P3ss33ss3_autogen___2(struct s3 *___dst__P3ss3_2, struct s3 ___src__3ss3_2){130 ((void)((*___dst__P3ss3_2).__i__i_2=___src__3ss3_2.__i__i_2));131 return ((struct s3 )___src__3ss3_2);132 }133 130 inline void ___constructor__F_P3ss3i_autogen___2(struct s3 *___dst__P3ss3_2, int __i__i_2){ 134 131 ((void)((*((int *)(&(*___dst__P3ss3_2).__i__i_2)))=__i__i_2) /* ?{} */); … … 139 136 int __i__i_2; 140 137 }; 138 inline struct s4 ___operator_assign__F3ss4_P3ss43ss4_autogen___2(struct s4 *___dst__P3ss4_2, struct s4 ___src__3ss4_2){ 139 ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2)); 140 return ((struct s4 )___src__3ss4_2); 141 } 141 142 inline void ___constructor__F_P3ss4_autogen___2(struct s4 *___dst__P3ss4_2){ 142 143 ((void)((*((int *)(&(*___dst__P3ss4_2).__i__i_2)))) /* ?{} */); … … 148 149 ((void)((*((int *)(&(*___dst__P3ss4_2).__i__i_2)))) /* ^?{} */); 149 150 } 150 inline struct s4 ___operator_assign__F3ss4_P3ss43ss4_autogen___2(struct s4 *___dst__P3ss4_2, struct s4 ___src__3ss4_2){151 ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2));152 return ((struct s4 )___src__3ss4_2);153 }154 151 inline void ___constructor__F_P3ss4i_autogen___2(struct s4 *___dst__P3ss4_2, int __i__i_2){ 155 152 ((void)((*((int *)(&(*___dst__P3ss4_2).__i__i_2)))=__i__i_2) /* ?{} */); … … 160 157 int __m2__A0A0i_2[((long unsigned int )10)][((long unsigned int )10)]; 161 158 int __m3__A0A0i_2[((long unsigned int )10)][((long unsigned int )10)]; 162 ((void)(___retval_main__i_1=((int )0)) /* ?{} */); 163 return ((int )___retval_main__i_1); 159 int _retVal0 = { 0 }; 160 ((void)(_retVal0=((int )0)) /* ?{} */); 161 return ((int )_retVal0); 164 162 } -
src/tests/.expect/castError.txt
r66f8528 r596f987b 1 Error: Can't choose between 3alternatives for expression Cast of:1 Error: Can't choose between alternatives for expression Cast of: 2 2 Name: f 3 3 -
src/tests/.expect/memberCtors.txt
r66f8528 r596f987b 6 6 constructing int 7 7 constructing int 8 begin construct B9 assign b->a210 8 constructing int 11 9 constructing int 12 begin construct A13 construct a->x14 10 constructing int: 1001 15 assign a->y16 11 assigning int: 0 0 17 end construct A18 construct b->a119 12 constructing int 20 13 constructing int 21 begin construct A22 construct a->x23 14 constructing int: 1000 24 assign a->y25 15 assigning int: 0 0 26 end construct A27 end construct B28 16 destructing int: 0 29 17 destructing int: 0 … … 32 20 copy constructing int: 0 33 21 copy constructing int: 0 34 begin copy construct A35 copy construct this->x36 22 copy constructing int: 1000 37 assign this->y38 end copy construct A39 23 copy constructing int: 0 40 24 copy constructing int: 0 41 begin copy construct A42 copy construct this->x43 25 copy constructing int: 1001 44 assign this->y45 end copy construct A46 26 copy constructing int: 0 47 27 copy constructing int: 0 48 begin copy construct A49 copy construct this->x50 28 copy constructing int: 0 51 assign this->y52 end copy construct A53 29 End of main 54 30 constructing int 55 31 constructing int 56 begin construct A57 construct a->x58 32 constructing int: 999 59 assign a->y60 33 assigning int: 0 0 61 end construct A62 34 destructing int: 0 63 35 destructing int: 0 … … 74 46 constructing int 75 47 constructing int 76 begin construct A77 construct a->x78 48 constructing int: 999 79 assign a->y80 49 assigning int: 0 0 81 end construct A82 50 destructing int: 0 83 51 destructing int: 0 -
src/tests/.expect/scopeErrors.txt
r66f8528 r596f987b 4 4 double 5 5 returning 6 _retval_butThisIsAnError:double6 double 7 7 with body 8 8 CompoundStmt -
src/tests/Makefile.am
r66f8528 r596f987b 67 67 memberCtors-ERR1: memberCtors.c 68 68 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} 69 70 completeTypeError : completeTypeError.c71 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} -
src/tests/Makefile.in
r66f8528 r596f987b 689 689 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@} 690 690 691 completeTypeError : completeTypeError.c692 ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}693 694 691 # Tell versions [3.59,3.63) of GNU make to not export all variables. 695 692 # Otherwise a system limit (for SysV at least) may be exceeded. -
src/tests/memberCtors.c
r66f8528 r596f987b 32 32 33 33 void ?{}(A * a, int x) { 34 printf("begin construct A\n");35 printf("construct a->x\n");36 34 (&a->x){ x+999 }; 37 printf("assign a->y\n");38 35 a->y = 0; // not a constructor - default constructor will be inserted 39 printf("end construct A\n");40 36 } // z never constructed - will be automatically default constructed 41 37 42 38 void ?{}(A * this, A other) { 43 printf("begin copy construct A\n");44 printf("copy construct this->x\n");45 39 (&this->x){ other.x }; 46 printf("assign this->y\n");47 40 this->y = other.y; // not a constructor - copy constructor will be inserted 48 printf("end copy construct A\n");49 41 } // z never constructed - will be automatically copy constructed 50 42 … … 54 46 55 47 void ?{}(B * b) { 56 printf("begin construct B\n");57 printf("assign b->a2\n");58 48 b->a2 = (A) { 2 }; 59 printf("construct b->a1\n");60 49 (&b->a1){ 1 }; 61 50 #ifdef ERR1 62 51 (&b->a2){ b->a3 }; // error, b->a2 was used previously but is explicitly constructed 63 52 #endif 64 printf("end construct B\n");65 53 } // a2, a3 never constructed - will be automatically default constructed 66 54 -
src/tests/shortCircuit.c
r66f8528 r596f987b 11 11 12 12 void g() { 13 int a;14 struct { int b; } a;15 if ( a ) {13 int a; 14 struct { int b; } a; 15 if ( a ) { 16 16 while ( a ) { 17 17 int *b; … … 19 19 } 20 20 } 21 }21 } 22 22 } 23 23 -
src/tests/tupleAssign.c
r66f8528 r596f987b 1 //2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo3 //4 // The contents of this file are covered under the licence agreement in the5 // file "LICENCE" distributed with Cforall.6 //7 // tupleAssign.c --8 //9 // Author : Rob Schluntz10 // Created On : Tue Nov 15 17:24:32 201611 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Nov 15 17:27:28 201613 // Update Count : 314 //15 16 1 int main() { 17 2 { … … 54 39 } 55 40 } 56 57 // Local Variables: //58 // tab-width: 4 //59 // End: // -
src/tests/tupleFunction.c
r66f8528 r596f987b 1 //2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo3 //4 // The contents of this file are covered under the licence agreement in the5 // file "LICENCE" distributed with Cforall.6 //7 // tupleFunction.c --8 //9 // Author : Rob Schluntz10 // Created On : Tue Nov 15 17:24:32 201611 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Nov 15 17:27:28 201613 // Update Count : 314 //15 16 1 struct S { 17 2 int f1, f2; … … 51 36 } 52 37 38 // forall(otype T | { T ?+?(T, T); }) 39 // [T, T, T] ?+?([T, T, T] x, [T, T, T] y) { 40 // T x1, x2, x3, y1, y2, y3; 41 // [x1, x2, x3] = x; 42 // [y1, y2, y3] = y; 43 // return [x1+y1, x2+y2, x3+y3]; 44 // } 45 53 46 int main() { 54 [int, double, int] x = [777, 2.76, 8675];55 int x1 = 123, x3 = 456;56 double x2 = 999.123;47 [int, double, int] x = [777, 2.76, 8675]; 48 int x1 = 123, x3 = 456; 49 double x2 = 999.123; 57 50 58 printf("foo(...)=%d\n", foo(x1, x3, x2, (S){ 321, 654, 'Q', 3.14 }));51 printf("foo(...)=%d\n", foo(x1, x3, x2, (S){ 321, 654, 'Q', 3.14 })); 59 52 60 53 // call function with tuple parameter using tuple variable arg … … 83 76 [x1, x2, x3] = quux(); 84 77 printf("x1=%d x2=%lg x3=%d\n", x1, x2, x3); 85 86 // xxx - tuples of type parameters should come out as generic types?87 // [x1, x2, x3] = ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);88 // ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);89 // printf("%d %g %d\n", x1, x2, x3);90 91 // xxx - comes out the back as a cast, but should come out as a tuple expression of the first n fields cast to each of the result types92 // ([int, double])x;93 78 } 94 95 // Local Variables: //96 // tab-width: 4 //97 // End: //98 -
src/tests/tupleMember.c
r66f8528 r596f987b 1 //2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo3 //4 // The contents of this file are covered under the licence agreement in the5 // file "LICENCE" distributed with Cforall.6 //7 // tupleFunction.c --8 //9 // Author : Rob Schluntz10 // Created On : Tue Nov 15 17:24:32 201611 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Nov 15 17:27:28 201613 // Update Count : 314 //15 16 1 void f() { 17 2 printf("called f!\n"); … … 56 41 printf("v.[f1, i.[f2, f3], f4]=[%d, [%d, %d], %lg]\n", h().[f1, i.[f2, f3], f4]); 57 42 } 58 59 // Local Variables: //60 // tab-width: 4 //61 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.