Changeset f8b961b


Ignore:
Timestamp:
Dec 3, 2015, 4:37:27 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, string, with_gc
Children:
47534159
Parents:
5bf4712
Message:

Documentation improvements

Location:
src/GenPoly
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r5bf4712 rf8b961b  
    5050                FunctionType *makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars );
    5151
     52                /// Replaces polymorphic return types with out-parameters, replaces calls to polymorphic functions with adapter calls as needed, and adds appropriate type variables to the function call
    5253                class Pass1 : public PolyMutator {
    5354                  public:
     
    8889                };
    8990
     91                /// Moves polymorphic returns in function types to pointer-type parameters, adds type size and assertion parameters to parameter lists as well
    9092                class Pass2 : public PolyMutator {
    9193                  public:
     
    105107                };
    106108
     109                /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, and sizeof expressions of polymorphic types with the proper variable
    107110                class Pass3 : public PolyMutator {
    108111                  public:
     
    10081011                        std::list< DeclarationWithType *> inferredParams;
    10091012                        ObjectDecl *newObj = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0 );
    1010 ///   ObjectDecl *newFunPtr = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 );
     1013//   ObjectDecl *newFunPtr = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 );
    10111014                        for ( std::list< TypeDecl *>::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
    10121015                                ObjectDecl *thisParm;
     
    10201023                                // move all assertions into parameter list
    10211024                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyParm)->get_assertions().begin(); assert != (*tyParm)->get_assertions().end(); ++assert ) {
    1022 ///      *assert = (*assert)->acceptMutator( *this );
     1025//      *assert = (*assert)->acceptMutator( *this );
    10231026                                        inferredParams.push_back( *assert );
    10241027                                }
     
    10621065
    10631066                TypeDecl * Pass3::mutate( TypeDecl *typeDecl ) {
    1064 ///   Initializer *init = 0;
    1065 ///   std::list< Expression *> designators;
    1066 ///   scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
    1067 ///   if ( typeDecl->get_base() ) {
    1068 ///     init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators );
    1069 ///   }
    1070 ///   return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init );
     1067//   Initializer *init = 0;
     1068//   std::list< Expression *> designators;
     1069//   scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
     1070//   if ( typeDecl->get_base() ) {
     1071//     init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators );
     1072//   }
     1073//   return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init );
    10711074
    10721075                        scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
  • src/GenPoly/FindFunction.h

    r5bf4712 rf8b961b  
    2323        typedef bool (*FindFunctionPredicate)( FunctionType*, const TyVarMap& );
    2424
     25        /// recursively walk `type`, placing all functions that match `predicate` under `tyVars` into `functions`
    2526        void findFunction( Type *type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
     27        /// like `findFunction`, but also replaces the function type with void ()(void)
    2628        void findAndReplaceFunction( Type *&type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
    2729} // namespace GenPoly
  • src/GenPoly/GenPoly.cc

    r5bf4712 rf8b961b  
    2121
    2222namespace GenPoly {
    23         // A function needs an adapter if it returns a polymorphic value or if any of its
    24         // parameters have polymorphic type
     23        /// A function needs an adapter if it returns a polymorphic value or if any of its
     24        /// parameters have polymorphic type
    2525        bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars ) {
    2626                if ( ! adaptee->get_returnVals().empty() && isPolyVal( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
  • src/GenPoly/Lvalue.cc

    r5bf4712 rf8b961b  
    3535                const std::list<Label> noLabels;
    3636
     37                /// Replace uses of lvalue returns with appropriate pointers
    3738                class Pass1 : public Mutator {
    3839                  public:
     
    4647                };
    4748
     49                /// Replace declarations of lvalue returns with appropriate pointers
    4850                class Pass2 : public Visitor {
    4951                  public:
  • src/GenPoly/ScrubTyVars.h

    r5bf4712 rf8b961b  
    2626          public:
    2727                ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
    28  
     28
     29                /// Like scrub( SynTreeClass* ), but only applies to type variables in `tyVars`
    2930                template< typename SynTreeClass >
    3031                static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
     32                /// Replaces dtypes and ftypes with the appropriate void type, and sizeof expressions of polymorphic types with the proper variable
    3133                template< typename SynTreeClass >
    3234                static SynTreeClass *scrub( SynTreeClass *target );
Note: See TracChangeset for help on using the changeset viewer.