Changes in src/SymTab/Autogen.h [6b0b624:8a6cf7e]
- File:
-
- 1 edited
-
src/SymTab/Autogen.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.h
r6b0b624 r8a6cf7e 10 10 // Created On : Sun May 17 21:53:34 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:50:25201713 // Update Count : 1 512 // Last Modified On : Wed Jun 21 17:25:26 2017 13 // Update Count : 14 14 14 // 15 15 16 #pragma once 16 #ifndef AUTOGEN_H 17 #define AUTOGEN_H 17 18 18 19 #include <string> … … 34 35 extern Type * SizeType; 35 36 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 // temporary 42 FunctionType * genAssignType( Type * paramType ); 43 36 44 /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. 37 45 template< typename OutputIterator > … … 42 50 template< typename OutputIterator > 43 51 Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) { 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 ) );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 ) ); 47 55 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 ); 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 ); 64 70 65 Statement * listInit = srcParam.buildListInit( fExpr );71 Statement * listInit = srcParam.buildListInit( fExpr ); 66 72 67 std::list< Expression * > args = *++srcParam;68 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 ); 69 75 70 *out++ = new ExprStmt( noLabels, fExpr );76 *out++ = new ExprStmt( noLabels, fExpr ); 71 77 72 srcParam.clearArrayIndices();78 srcParam.clearArrayIndices(); 73 79 74 return listInit;80 return listInit; 75 81 } 76 82 … … 108 114 109 115 UntypedExpr *inc = new UntypedExpr( update ); 110 inc->get_args().push_back( new AddressExpr( new VariableExpr( index )) );116 inc->get_args().push_back( new VariableExpr( index ) ); 111 117 112 118 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) ); … … 173 179 } 174 180 } // namespace SymTab 175 176 // Local Variables: // 177 // tab-width: 4 // 178 // mode: c++ // 179 // compile-command: "make install" // 180 // End: // 181 181 #endif // AUTOGEN_H
Note:
See TracChangeset
for help on using the changeset viewer.