Changes in src/SymTab/Autogen.h [a4477db:d180746]
- File:
-
- 1 edited
-
src/SymTab/Autogen.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.h
ra4477db rd180746 40 40 extern Type * SizeType; 41 41 42 /// intrinsic dereference operator for unqualified types - set when *? function is seen in FindSpecialDeclarations.43 /// Useful for creating dereference ApplicationExprs without a full resolver pass.44 extern FunctionDecl * dereferenceOperator;45 46 // generate the type of an assignment function for paramType47 FunctionType * genAssignType( Type * paramType );48 49 // generate the type of a default constructor or destructor for paramType50 FunctionType * genDefaultType( Type * paramType );51 52 // generate the type of a copy constructor for paramType53 FunctionType * genDefaultType( Type * paramType );54 55 42 /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. 56 43 template< typename OutputIterator > … … 61 48 template< typename OutputIterator > 62 49 Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) { 63 // want to be able to generate assignment, ctor, and dtor generically,64 // so fname is either ?=?, ?{}, or ^?{}65 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );50 // want to be able to generate assignment, ctor, and dtor generically, 51 // so fname is either ?=?, ?{}, or ^?{} 52 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) ); 66 53 67 if ( addCast ) { 68 // cast to T& with qualifiers removed, so that qualified objects can be constructed 69 // and destructed with the same functions as non-qualified objects. 70 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument 71 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever 72 // remove lvalue as a qualifier, this can change to 73 // type->get_qualifiers() = Type::Qualifiers(); 74 assert( type ); 75 Type * castType = type->clone(); 76 castType->get_qualifiers() -= Type::Qualifiers( Type::Lvalue | Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 77 // castType->set_lvalue( true ); // xxx - might not need this 78 dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) ); 79 } 80 fExpr->get_args().push_back( dstParam ); 54 // do something special for unnamed members 55 dstParam = new AddressExpr( dstParam ); 56 if ( addCast ) { 57 // cast to T* with qualifiers removed, so that qualified objects can be constructed 58 // and destructed with the same functions as non-qualified objects. 59 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument 60 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever 61 // remove lvalue as a qualifier, this can change to 62 // type->get_qualifiers() = Type::Qualifiers(); 63 assert( type ); 64 Type * castType = type->clone(); 65 castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 66 castType->set_lvalue( true ); // xxx - might not need this 67 dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) ); 68 } 69 fExpr->get_args().push_back( dstParam ); 81 70 82 Statement * listInit = srcParam.buildListInit( fExpr );71 Statement * listInit = srcParam.buildListInit( fExpr ); 83 72 84 std::list< Expression * > args = *++srcParam;85 fExpr->get_args().splice( fExpr->get_args().end(), args );73 std::list< Expression * > args = *++srcParam; 74 fExpr->get_args().splice( fExpr->get_args().end(), args ); 86 75 87 *out++ = new ExprStmt( noLabels, fExpr );76 *out++ = new ExprStmt( noLabels, fExpr ); 88 77 89 srcParam.clearArrayIndices();78 srcParam.clearArrayIndices(); 90 79 91 return listInit;80 return listInit; 92 81 } 93 82 … … 125 114 126 115 UntypedExpr *inc = new UntypedExpr( update ); 127 inc->get_args().push_back( new VariableExpr( index) );116 inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) ); 128 117 129 118 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
Note:
See TracChangeset
for help on using the changeset viewer.