Changeset aa19ccf


Ignore:
Timestamp:
Apr 13, 2016, 3:02:30 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
02ad3f5
Parents:
3849857
Message:

Box no longer marks generic type layouts calculated past scope of declaration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r3849857 raa19ccf  
    292292                        /// adds type parameters to the layout call; will generate the appropriate parameters if needed
    293293                        void addOtypeParamsToLayoutCall( UntypedExpr *layoutCall, const std::list< Type* > &otypeParams );
     294
     295                        /// Enters a new scope for type-variables, adding the type variables from ty
     296                        void beginTypeScope( Type *ty );
     297                        /// Exits the type-variable scope
     298                        void endTypeScope();
    294299                       
    295300                        ScopedSet< std::string > knownLayouts;          ///< Set of generic type layouts known in the current scope, indexed by sizeofName
     
    18211826////////////////////////////////////////// PolyGenericCalculator ////////////////////////////////////////////////////
    18221827
     1828                void PolyGenericCalculator::beginTypeScope( Type *ty ) {
     1829                        scopeTyVars.beginScope();
     1830                        makeTyVarMap( ty, scopeTyVars );
     1831                }
     1832
     1833                void PolyGenericCalculator::endTypeScope() {
     1834                        scopeTyVars.endScope();
     1835                }
     1836
    18231837                template< typename DeclClass >
    18241838                DeclClass * PolyGenericCalculator::handleDecl( DeclClass *decl, Type *type ) {
    1825                         scopeTyVars.beginScope();
    1826                         makeTyVarMap( type, scopeTyVars );
     1839                        beginTypeScope( type );
     1840                        knownLayouts.beginScope();
     1841                        knownOffsets.beginScope();
    18271842
    18281843                        DeclClass *ret = static_cast< DeclClass *>( Mutator::mutate( decl ) );
    18291844
    1830                         scopeTyVars.endScope();
     1845                        knownOffsets.endScope();
     1846                        knownLayouts.endScope();
     1847                        endTypeScope();
    18311848                        return ret;
    18321849                }
     
    18501867
    18511868                Type * PolyGenericCalculator::mutate( PointerType *pointerType ) {
    1852                         scopeTyVars.beginScope();
    1853                         makeTyVarMap( pointerType, scopeTyVars );
     1869                        beginTypeScope( pointerType );
    18541870
    18551871                        Type *ret = Mutator::mutate( pointerType );
    18561872
    1857                         scopeTyVars.endScope();
     1873                        endTypeScope();
    18581874                        return ret;
    18591875                }
    18601876
    18611877                Type * PolyGenericCalculator::mutate( FunctionType *funcType ) {
    1862                         scopeTyVars.beginScope();
    1863                         makeTyVarMap( funcType, scopeTyVars );
     1878                        beginTypeScope( funcType );
    18641879
    18651880                        // make sure that any type information passed into the function is accounted for
     
    18741889                        Type *ret = Mutator::mutate( funcType );
    18751890
    1876                         scopeTyVars.endScope();
     1891                        endTypeScope();
    18771892                        return ret;
    18781893                }
Note: See TracChangeset for help on using the changeset viewer.