Changeset 2c57025 for src/GenPoly/Box.cc


Ignore:
Timestamp:
Nov 25, 2016, 6:11:03 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
0f35657
Parents:
186fd86
Message:

add support for built-in sized trait which decouples size/alignment information from otype parameters, add test for sized trait

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r186fd86 r2c57025  
    275275
    276276                for ( std::list< TypeDecl* >::const_iterator decl = decls.begin(); decl != decls.end(); ++decl ) {
    277                         if ( (*decl)->get_kind() == TypeDecl::Any ) {
     277                        if ( (*decl)->isComplete() ) {
    278278                                otypeDecls.push_back( *decl );
    279279                        }
     
    719719
    720720                TypeDecl *Pass1::mutate( TypeDecl *typeDecl ) {
    721                         scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
     721                        addToTyVarMap( typeDecl, scopeTyVars );
    722722                        return Mutator::mutate( typeDecl );
    723723                }
     
    774774                                ResolvExpr::EqvClass eqvClass;
    775775                                assert( env );
    776                                 if ( tyParm->second == TypeDecl::Any ) {
     776                                if ( tyParm->second.isComplete ) {
    777777                                        Type *concrete = env->lookup( tyParm->first );
    778778                                        if ( concrete ) {
     
    12781278                        std::list< Expression *>::iterator paramBegin = appExpr->get_args().begin();
    12791279
    1280                         TyVarMap exprTyVars( (TypeDecl::Kind)-1 );
     1280                        TyVarMap exprTyVars( TypeDecl::Data{} );
    12811281                        makeTyVarMap( function, exprTyVars );
    12821282                        ReferenceToType *dynRetType = isDynRet( function, exprTyVars );
     
    14281428
    14291429                                                // skip non-otype parameters (ftype/dtype)
     1430                                                // xxx - should this check whether the type is complete instead?
    14301431                                                if ( (*forallIt)->get_kind() != TypeDecl::Any ) continue;
    14311432
     
    15531554
    15541555                TypeDecl * Pass2::mutate( TypeDecl *typeDecl ) {
    1555                         scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
     1556                        addToTyVarMap( typeDecl, scopeTyVars );
    15561557                        if ( typeDecl->get_base() ) {
    15571558                                return handleDecl( typeDecl, typeDecl->get_base() );
     
    15971598                                ObjectDecl *sizeParm, *alignParm;
    15981599                                // add all size and alignment parameters to parameter list
    1599                                 if ( (*tyParm)->get_kind() == TypeDecl::Any ) {
     1600                                if ( (*tyParm)->isComplete() ) {
    16001601                                        TypeInstType parmType( Type::Qualifiers(), (*tyParm)->get_name(), *tyParm );
    16011602                                        std::string parmName = mangleType( &parmType );
     
    17061707
    17071708                TypeDecl * PolyGenericCalculator::mutate( TypeDecl *typeDecl ) {
    1708                         scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
     1709                        addToTyVarMap( typeDecl, scopeTyVars );
    17091710                        return Parent::mutate( typeDecl );
    17101711                }
     
    18701871                        for ( ; baseParam != baseParams.end() && typeParam != typeParams.end(); ++baseParam, ++typeParam ) {
    18711872                                // skip non-otype parameters
    1872                                 if ( (*baseParam)->get_kind() != TypeDecl::Any ) continue;
     1873                                if ( ! (*baseParam)->isComplete() ) continue;
    18731874                                TypeExpr *typeExpr = dynamic_cast< TypeExpr* >( *typeParam );
    18741875                                assert( typeExpr && "all otype parameters should be type expressions" );
     
    20822083//   Initializer *init = 0;
    20832084//   std::list< Expression *> designators;
    2084 //   scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
     2085//   addToTyVarMap( typeDecl, scopeTyVars );
    20852086//   if ( typeDecl->get_base() ) {
    20862087//     init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators );
     
    20882089//   return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init );
    20892090
    2090                         scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
     2091                        addToTyVarMap( typeDecl, scopeTyVars );
    20912092                        return Mutator::mutate( typeDecl );
    20922093                }
Note: See TracChangeset for help on using the changeset viewer.