Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.h

    rd180746 r8404321  
    4040        extern Type * SizeType;
    4141
     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 * genCopyType( Type * paramType );
     54
    4255        /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
    4356        template< typename OutputIterator >
     
    4861        template< typename OutputIterator >
    4962        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 ) );
    5366
    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 );
    7081
    71         Statement * listInit = srcParam.buildListInit( fExpr );
     82                Statement * listInit = srcParam.buildListInit( fExpr );
    7283
    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 );
    7586
    76         *out++ = new ExprStmt( noLabels, fExpr );
     87                *out++ = new ExprStmt( noLabels, fExpr );
    7788
    78         srcParam.clearArrayIndices();
     89                srcParam.clearArrayIndices();
    7990
    80         return listInit;
     91                return listInit;
    8192        }
    8293
     
    114125
    115126                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 ) );
    117128
    118129                UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
Note: See TracChangeset for help on using the changeset viewer.