Changes in src/SymTab/Autogen.h [8a6cf7e:6b0b624]
- File:
-
- 1 edited
-
src/SymTab/Autogen.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.h
r8a6cf7e r6b0b624 10 10 // Created On : Sun May 17 21:53:34 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 17:25:26201713 // Update Count : 1 412 // Last Modified On : Sat Jul 22 09:50:25 2017 13 // Update Count : 15 14 14 // 15 15 16 #ifndef AUTOGEN_H 17 #define AUTOGEN_H 16 #pragma once 18 17 19 18 #include <string> … … 35 34 extern Type * SizeType; 36 35 37 /// intrinsic dereference operator for unqualified types - set when *? function is seen in FindSpecialDeclarations.38 /// Useful for creating dereference ApplicationExprs without a full resolver pass.39 extern FunctionDecl * dereferenceOperator;40 41 // temporary42 FunctionType * genAssignType( Type * paramType );43 44 36 /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. 45 37 template< typename OutputIterator > … … 50 42 template< typename OutputIterator > 51 43 Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) { 52 // want to be able to generate assignment, ctor, and dtor generically,53 // so fname is either ?=?, ?{}, or ^?{}54 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );44 // want to be able to generate assignment, ctor, and dtor generically, 45 // so fname is either ?=?, ?{}, or ^?{} 46 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) ); 55 47 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::Lvalue | Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 66 // castType->set_lvalue( true ); // xxx - might not need this 67 dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) ); 68 } 69 fExpr->get_args().push_back( dstParam ); 48 // do something special for unnamed members 49 dstParam = new AddressExpr( dstParam ); 50 if ( addCast ) { 51 // cast to T* with qualifiers removed, so that qualified objects can be constructed 52 // and destructed with the same functions as non-qualified objects. 53 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument 54 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever 55 // remove lvalue as a qualifier, this can change to 56 // type->get_qualifiers() = Type::Qualifiers(); 57 assert( type ); 58 Type * castType = type->clone(); 59 castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 60 castType->set_lvalue( true ); // xxx - might not need this 61 dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) ); 62 } 63 fExpr->get_args().push_back( dstParam ); 70 64 71 Statement * listInit = srcParam.buildListInit( fExpr );65 Statement * listInit = srcParam.buildListInit( fExpr ); 72 66 73 std::list< Expression * > args = *++srcParam;74 fExpr->get_args().splice( fExpr->get_args().end(), args );67 std::list< Expression * > args = *++srcParam; 68 fExpr->get_args().splice( fExpr->get_args().end(), args ); 75 69 76 *out++ = new ExprStmt( noLabels, fExpr );70 *out++ = new ExprStmt( noLabels, fExpr ); 77 71 78 srcParam.clearArrayIndices();72 srcParam.clearArrayIndices(); 79 73 80 return listInit;74 return listInit; 81 75 } 82 76 … … 114 108 115 109 UntypedExpr *inc = new UntypedExpr( update ); 116 inc->get_args().push_back( new VariableExpr( index) );110 inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) ); 117 111 118 112 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) ); … … 179 173 } 180 174 } // namespace SymTab 181 #endif // AUTOGEN_H 175 176 // Local Variables: // 177 // tab-width: 4 // 178 // mode: c++ // 179 // compile-command: "make install" // 180 // End: // 181
Note:
See TracChangeset
for help on using the changeset viewer.