Changeset 235b41f for src/GenPoly


Ignore:
Timestamp:
Sep 5, 2017, 3:41:04 PM (8 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:
416cc86
Parents:
800d275 (diff), 3f8dd01 (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

Location:
src/GenPoly
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r800d275 r235b41f  
    141141                        virtual StructDecl *mutate( StructDecl *structDecl ) override;
    142142                        virtual UnionDecl *mutate( UnionDecl *unionDecl ) override;
     143                        virtual TraitDecl *mutate( TraitDecl *unionDecl ) override;
    143144                        virtual TypeDecl *mutate( TypeDecl *typeDecl ) override;
    144145                        virtual TypedefDecl *mutate( TypedefDecl *typedefDecl ) override;
     
    216217                  private:
    217218                };
    218 
    219219        } // anonymous namespace
    220220
     
    896896                                addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
    897897                                bodyStmt = new ExprStmt( noLabels, adapteeApp );
    898 //                      } else if ( isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    899898                        } else if ( isDynType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    900899                                // return type T
     
    12991298                }
    13001299
    1301                 /// determines if `pref` is a prefix of `str`
    1302                 bool isPrefix( const std::string & str, const std::string & pref ) {
    1303                         if ( pref.size() > str.size() ) return false;
    1304                         auto its = std::mismatch( pref.begin(), pref.end(), str.begin() );
    1305                         return its.first == pref.end();
    1306                 }
    1307 
    13081300                DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) {
    13091301                        functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) );
     
    13521344                }
    13531345
     1346                TraitDecl * Pass2::mutate( TraitDecl *aggDecl ) {
     1347                        return handleAggDecl( aggDecl );
     1348                }
     1349
    13541350                TypeDecl * Pass2::mutate( TypeDecl *typeDecl ) {
    13551351                        addToTyVarMap( typeDecl, scopeTyVars );
     
    13771373                Type *Pass2::mutate( FunctionType *funcType ) {
    13781374                        scopeTyVars.beginScope();
     1375
    13791376                        makeTyVarMap( funcType, scopeTyVars );
    13801377
     
    15501547                                        // (alloca was previously used, but can't be safely used in loops)
    15511548                                        Type *declType = objectDecl->get_type();
    1552                                         std::string bufName = bufNamer.newName();
    1553                                         ObjectDecl *newBuf = new ObjectDecl( bufName, Type::StorageClasses(), LinkageSpec::C, 0,
     1549                                        ObjectDecl *newBuf = new ObjectDecl( bufNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0,
    15541550                                                new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Kind::Char), new NameExpr( sizeofName( mangleType(declType) ) ),
    1555                                                 true, false, std::list<Attribute*>{ new Attribute( std::string{"aligned"}, std::list<Expression*>{ new ConstantExpr( Constant::from_int(8) ) } ) } ), 0 );
     1551                                                true, false, std::list<Attribute*>{ new Attribute( "aligned", std::list<Expression*>{ new ConstantExpr( Constant::from_int(8) ) } ) } ), 0 );
    15561552                                        stmtsToAdd.push_back( new DeclStmt( noLabels, newBuf ) );
    15571553
    15581554                                        delete objectDecl->get_init();
    1559 
    1560                                         objectDecl->set_init( new SingleInit( new NameExpr( bufName ) ) );
     1555                                        objectDecl->set_init( new SingleInit( new VariableExpr( newBuf ) ) );
    15611556                                }
    15621557                        }
  • src/GenPoly/GenPoly.cc

    r800d275 r235b41f  
    336336                                assertf(bparam, "Aggregate parameters should be type expressions");
    337337
    338                                 // xxx - might need to let VoidType be a wildcard here too; could have some voids 
     338                                // xxx - might need to let VoidType be a wildcard here too; could have some voids
    339339                                // stuffed in for dtype-statics.
    340340                                // if ( is<VoidType>( aparam->get_type() ) || is<VoidType>( bparam->get_type() ) ) continue;
    341341                                if ( ! typesPolyCompatible( aparam->get_type(), bparam->get_type() ) ) return false;
    342342                        }
    343                        
     343
    344344                        return true;
    345345                }
     
    350350                // polymorphic types always match
    351351                if ( aid == type_index{typeid(TypeInstType)} ) return true;
    352                
     352
    353353                type_index bid{ typeid(*b) };
    354354                // polymorphic types always match
    355355                if ( bid == type_index{typeid(TypeInstType)} ) return true;
    356                
     356
    357357                // can't match otherwise if different types
    358358                if ( aid != bid ) return false;
     
    377377                                ConstantExpr *ad = dynamic_cast<ConstantExpr*>( aa->get_dimension() );
    378378                                ConstantExpr *bd = dynamic_cast<ConstantExpr*>( ba->get_dimension() );
    379                                 if ( ad && bd 
     379                                if ( ad && bd
    380380                                                && ad->get_constant()->get_value() != bd->get_constant()->get_value() )
    381381                                        return false;
     
    433433
    434434        void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap ) {
     435                // xxx - should this actually be insert?
    435436                tyVarMap[ tyVar->get_name() ] = TypeDecl::Data{ tyVar };
    436437        }
Note: See TracChangeset for help on using the changeset viewer.