Changeset 4d4882a
- Timestamp:
- Sep 1, 2016, 4:53:22 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 44f6341
- Parents:
- fba44f8
- Location:
- src
- Files:
-
- 3 added
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/InitTweak/FixInit.cc ¶
rfba44f8 r4d4882a 787 787 UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) ); 788 788 deref->get_args().push_back( new VariableExpr( thisParam ) ); 789 InitExpander srcParam( (Initializer *)NULL ); // xxx - if copy ctor, need to pass appropriate argument - second param of this function dot member 789 790 Expression * arg2 = 0; 791 if ( isCopyConstructor( function ) ) { 792 // if copy ctor, need to pass second-param-of-this-function.member 793 std::list< DeclarationWithType * > & params = function->get_functionType()->get_parameters(); 794 assert( params.size() == 2 ); 795 arg2 = new MemberExpr( member, new VariableExpr( params.back() ) ); 796 } 797 InitExpander srcParam( arg2 ); 790 798 SymTab::genImplicitCall( srcParam, new MemberExpr( member, deref ), function->get_name(), back_inserter( stmt ), member, isCtor ); 791 799 … … 832 840 handleFirstParam( firstParam ); 833 841 } 834 } else if ( fname == "?=?" && isIntrinsicCallExpr( appExpr ) ) {835 // forgive use of intrinsic assignment to construct, since instrinsic constructors836 // codegen as assignment anyway.837 assert( appExpr->get_args().size() == 2 );838 handleFirstParam( appExpr->get_args().front() );839 842 } 840 843 -
TabularUnified src/InitTweak/InitTweak.cc ¶
rfba44f8 r4d4882a 7 7 #include "SynTree/Attribute.h" 8 8 #include "GenPoly/GenPoly.h" 9 #include "ResolvExpr/typeops.h" 9 10 10 11 namespace InitTweak { … … 439 440 bool isDestructor( const std::string & str ) { return str == "^?{}"; } 440 441 bool isCtorDtor( const std::string & str ) { return isConstructor( str ) || isDestructor( str ); } 442 443 FunctionDecl * isCopyConstructor( Declaration * decl ) { 444 FunctionDecl * function = dynamic_cast< FunctionDecl * >( decl ); 445 if ( ! function ) return 0; 446 if ( ! isConstructor( function->get_name() ) ) return 0; 447 FunctionType * ftype = function->get_functionType(); 448 if ( ftype->get_parameters().size() != 2 ) return 0; 449 450 Type * t1 = ftype->get_parameters().front()->get_type(); 451 Type * t2 = ftype->get_parameters().back()->get_type(); 452 PointerType * ptrType = dynamic_cast< PointerType * > ( t1 ); 453 assert( ptrType ); 454 455 if ( ResolvExpr::typesCompatible( ptrType->get_base(), t2, SymTab::Indexer() ) ) { 456 return function; 457 } else { 458 return 0; 459 } 460 } 441 461 } -
TabularUnified src/InitTweak/InitTweak.h ¶
rfba44f8 r4d4882a 29 29 bool isDestructor( const std::string & ); 30 30 bool isCtorDtor( const std::string & ); 31 32 FunctionDecl * isCopyConstructor( Declaration * decl ); 31 33 32 34 /// transform Initializer into an argument list that can be passed to a call expression -
TabularUnified src/SynTree/FunctionDecl.cc ¶
rfba44f8 r4d4882a 21 21 #include "Attribute.h" 22 22 #include "Common/utility.h" 23 #include "InitTweak/InitTweak.h" 23 24 24 25 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes ) -
TabularUnified src/tests/Makefile.am ¶
rfba44f8 r4d4882a 62 62 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 63 63 64 ctorWarnings: ctorWarnings.c65 ${CC} ${CFALGS} - CFA -XCFA -p${<} -o ${@}64 memberCtors-ERR1: memberCtors.c 65 ${CC} ${CFALGS} -DERR1 ${<} -o ${@} 66 66 -
TabularUnified src/tests/Makefile.in ¶
rfba44f8 r4d4882a 670 670 ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@} 671 671 672 ctorWarnings: ctorWarnings.c673 ${CC} ${CFALGS} - CFA -XCFA -p${<} -o ${@}672 memberCtors-ERR1: memberCtors.c 673 ${CC} ${CFALGS} -DERR1 ${<} -o ${@} 674 674 675 675 # Tell versions [3.59,3.63) of GNU make to not export all variables.
Note: See TracChangeset
for help on using the changeset viewer.