Ignore:
Timestamp:
Aug 25, 2017, 10:38:34 AM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.h

    raf08051 r28e58fd  
    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        // temporary
     47        FunctionType * genAssignType( Type * paramType );
     48
    4249        /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
    4350        template< typename OutputIterator >
     
    4855        template< typename OutputIterator >
    4956        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 ) );
    5360
    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 );
    7075
    71         Statement * listInit = srcParam.buildListInit( fExpr );
     76                Statement * listInit = srcParam.buildListInit( fExpr );
    7277
    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 );
    7580
    76         *out++ = new ExprStmt( noLabels, fExpr );
     81                *out++ = new ExprStmt( noLabels, fExpr );
    7782
    78         srcParam.clearArrayIndices();
     83                srcParam.clearArrayIndices();
    7984
    80         return listInit;
     85                return listInit;
    8186        }
    8287
     
    114119
    115120                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 ) );
    117122
    118123                UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
Note: See TracChangeset for help on using the changeset viewer.