Changes in src/SymTab/Autogen.h [d180746:a4477db]
- File:
-
- 1 edited
-
src/SymTab/Autogen.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.h
rd180746 ra4477db 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 paramType 47 FunctionType * genAssignType( Type * paramType ); 48 49 // generate the type of a default constructor or destructor for paramType 50 FunctionType * genDefaultType( Type * paramType ); 51 52 // generate the type of a copy constructor for paramType 53 FunctionType * genDefaultType( Type * paramType ); 54 42 55 /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. 43 56 template< typename OutputIterator > … … 48 61 template< typename OutputIterator > 49 62 Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) { 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 ) );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 ) ); 53 66 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 ); 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 ); 70 81 71 Statement * listInit = srcParam.buildListInit( fExpr );82 Statement * listInit = srcParam.buildListInit( fExpr ); 72 83 73 std::list< Expression * > args = *++srcParam;74 fExpr->get_args().splice( fExpr->get_args().end(), args );84 std::list< Expression * > args = *++srcParam; 85 fExpr->get_args().splice( fExpr->get_args().end(), args ); 75 86 76 *out++ = new ExprStmt( noLabels, fExpr );87 *out++ = new ExprStmt( noLabels, fExpr ); 77 88 78 srcParam.clearArrayIndices();89 srcParam.clearArrayIndices(); 79 90 80 return listInit;91 return listInit; 81 92 } 82 93 … … 114 125 115 126 UntypedExpr *inc = new UntypedExpr( update ); 116 inc->get_args().push_back( new AddressExpr( new VariableExpr( index )) );127 inc->get_args().push_back( new VariableExpr( index ) ); 117 128 118 129 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
Note:
See TracChangeset
for help on using the changeset viewer.