Changeset 28e58fd for src/SymTab/Autogen.h
- Timestamp:
- Aug 25, 2017, 10:38:34 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, 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:
- 800d275
- Parents:
- af08051 (diff), 3eab308c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.h
raf08051 r28e58fd 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 // temporary 47 FunctionType * genAssignType( Type * paramType ); 48 42 49 /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. 43 50 template< typename OutputIterator > … … 48 55 template< typename OutputIterator > 49 56 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 ) );57 // want to be able to generate assignment, ctor, and dtor generically, 58 // so fname is either ?=?, ?{}, or ^?{} 59 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) ); 53 60 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 ); 61 if ( addCast ) { 62 // cast to T& with qualifiers removed, so that qualified objects can be constructed 63 // and destructed with the same functions as non-qualified objects. 64 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument 65 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever 66 // remove lvalue as a qualifier, this can change to 67 // type->get_qualifiers() = Type::Qualifiers(); 68 assert( type ); 69 Type * castType = type->clone(); 70 castType->get_qualifiers() -= Type::Qualifiers( Type::Lvalue | Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 71 // castType->set_lvalue( true ); // xxx - might not need this 72 dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) ); 73 } 74 fExpr->get_args().push_back( dstParam ); 70 75 71 Statement * listInit = srcParam.buildListInit( fExpr );76 Statement * listInit = srcParam.buildListInit( fExpr ); 72 77 73 std::list< Expression * > args = *++srcParam;74 fExpr->get_args().splice( fExpr->get_args().end(), args );78 std::list< Expression * > args = *++srcParam; 79 fExpr->get_args().splice( fExpr->get_args().end(), args ); 75 80 76 *out++ = new ExprStmt( noLabels, fExpr );81 *out++ = new ExprStmt( noLabels, fExpr ); 77 82 78 srcParam.clearArrayIndices();83 srcParam.clearArrayIndices(); 79 84 80 return listInit;85 return listInit; 81 86 } 82 87 … … 114 119 115 120 UntypedExpr *inc = new UntypedExpr( update ); 116 inc->get_args().push_back( new AddressExpr( new VariableExpr( index )) );121 inc->get_args().push_back( new VariableExpr( index ) ); 117 122 118 123 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
Note: See TracChangeset
for help on using the changeset viewer.